From cd21b284d92bac8112d321144e120edfd1cb0845 Mon Sep 17 00:00:00 2001 From: huanghui Date: Tue, 23 Feb 2021 14:47:17 +0800 Subject: [PATCH] fix ConvertAttrValuetoString --- .../backend/optimizer/ascend/mindir/conv2d_unify_mindir.cc | 6 +++++- mindspore/core/utils/check_convert_utils.cc | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/mindspore/ccsrc/backend/optimizer/ascend/mindir/conv2d_unify_mindir.cc b/mindspore/ccsrc/backend/optimizer/ascend/mindir/conv2d_unify_mindir.cc index 559174e557..83b55c1924 100644 --- a/mindspore/ccsrc/backend/optimizer/ascend/mindir/conv2d_unify_mindir.cc +++ b/mindspore/ccsrc/backend/optimizer/ascend/mindir/conv2d_unify_mindir.cc @@ -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) { diff --git a/mindspore/core/utils/check_convert_utils.cc b/mindspore/core/utils/check_convert_utils.cc index d09d4dbf9c..92f1fcd9d6 100644 --- a/mindspore/core/utils/check_convert_utils.cc +++ b/mindspore/core/utils/check_convert_utils.cc @@ -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()) { @@ -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()) {