Browse Source

!12536 Fix ConvertAttrValuetoString error when attr value is null

From: @irmo
Reviewed-by: @zh_qh,@hwhewei
Signed-off-by: @zh_qh
tags/v1.2.0-rc1
mindspore-ci-bot Gitee 4 years ago
parent
commit
a2b12db8d0
2 changed files with 7 additions and 3 deletions
  1. +5
    -1
      mindspore/ccsrc/backend/optimizer/ascend/mindir/conv2d_unify_mindir.cc
  2. +2
    -2
      mindspore/core/utils/check_convert_utils.cc

+ 5
- 1
mindspore/ccsrc/backend/optimizer/ascend/mindir/conv2d_unify_mindir.cc View File

@@ -223,7 +223,11 @@ void SetConv2DAttrs(const CNodePtr &conv2d, const CNodePtr &depth_conv) {
SetCommonAttrs(conv2d, depth_conv);
AnfAlgo::CopyNodeAttr(kAttrInputNames, conv2d, depth_conv);
AnfAlgo::CopyNodeAttr(kAttrStride, conv2d, depth_conv);
AnfAlgo::CopyNodeAttr(kAttrOffsetA, conv2d, depth_conv);
if (AnfAlgo::HasNodeAttr(kAttrOffsetA, conv2d)) {
AnfAlgo::CopyNodeAttr(kAttrOffsetA, conv2d, depth_conv);
} else {
AnfAlgo::SetNodeAttr(kAttrOffsetA, MakeValue(0), depth_conv);
}
}

void SetConv2DBackpropInputAttrs(const CNodePtr &conv2d_backin, const CNodePtr &depth_conv_backin) {


+ 2
- 2
mindspore/core/utils/check_convert_utils.cc View File

@@ -231,7 +231,7 @@ bool CheckAndConvertUtils::ConvertAttrValueToInt(const std::string &op_type, con
bool CheckAndConvertUtils::ConvertAttrValueToString(const std::string &op_type, const std::string &attr_name,
ValuePtr *const value) {
if (value == nullptr || *value == nullptr) {
MS_LOG(ERROR) << "value is nullptr";
MS_LOG(INFO) << "value is nullptr! op_type = " << op_type << ", attr_name = " << attr_name;
return false;
}
if (!(*value)->isa<Int64Imm>()) {
@@ -587,7 +587,7 @@ TypeId CheckAndConvertUtils::CheckTypeSame(const std::string &arg_name, const Ty
bool CheckAndConvertUtils::CheckIrAttrtoOpAttr(const std::string &op_type, const std::string &attr_name,
ValuePtr *const value) {
if (*value == nullptr) {
MS_LOG(ERROR) << "value is nullptr";
MS_LOG(INFO) << "value is nullptr! op_type = " << op_type << ", attr_name = " << attr_name;
return false;
}
if (op_type.empty() || attr_name.empty()) {


Loading…
Cancel
Save