diff --git a/mindspore/core/utils/check_convert_utils.cc b/mindspore/core/utils/check_convert_utils.cc index 436f9db15a1..c72a6cf1635 100644 --- a/mindspore/core/utils/check_convert_utils.cc +++ b/mindspore/core/utils/check_convert_utils.cc @@ -389,8 +389,7 @@ std::vector CheckAndConvertUtils::ConvertShapePtrToShape(const std::str const std::string &prim_name) { MS_EXCEPTION_IF_NULL(shape); if (!shape->isa()) { - MS_EXCEPTION(ValueError) << "The " << arg_name << "'s shape is " << shape->ToString() - << "should be a common shape!"; + return std::vector(); } auto shape_element = shape->cast(); MS_EXCEPTION_IF_NULL(shape_element); @@ -500,7 +499,7 @@ TypePtr CheckAndConvertUtils::_CheckTypeSame(const std::mapisa())) { + if (tensor_flag ^ type->isa()) { buffer << "For " << prim_name << "'s " << "type is not same"; for (const auto &error_elem : args) { diff --git a/mindspore/core/utils/check_convert_utils.h b/mindspore/core/utils/check_convert_utils.h index e9e1f0f3919..bc07d403126 100644 --- a/mindspore/core/utils/check_convert_utils.h +++ b/mindspore/core/utils/check_convert_utils.h @@ -208,7 +208,7 @@ class CheckAndConvertUtils { MS_EXCEPTION(NotExistsError) << "compare_operator " << compare_operator << " cannot find in the compare map"; } if (range.first >= range.second) { - MS_EXCEPTION(ArgumentError) << "the check range left must be larger than right number bug got [ " << range.first + MS_EXCEPTION(ArgumentError) << "the check range left must be smaller than right number bug got [ " << range.first << "," << range.second; } if (iter->second(arg_value, range)) { @@ -227,7 +227,8 @@ class CheckAndConvertUtils { << " cannot find in the compare string map"; } auto range_strng = iter_to_string->second; - buffer << range_strng.first << range.first << "," << range_strng.second << " , but got " << arg_value; + buffer << range_strng.first << range.first << "," << range.second << range_strng.second << " , but got " + << arg_value; MS_EXCEPTION(ValueError) << buffer.str(); }