From: @liangzhibo Reviewed-by: @ginfung,@zh_qh Signed-off-by: @zh_qhpull/14381/MERGE
| @@ -389,8 +389,7 @@ std::vector<int64_t> CheckAndConvertUtils::ConvertShapePtrToShape(const std::str | |||||
| const std::string &prim_name) { | const std::string &prim_name) { | ||||
| MS_EXCEPTION_IF_NULL(shape); | MS_EXCEPTION_IF_NULL(shape); | ||||
| if (!shape->isa<abstract::Shape>()) { | if (!shape->isa<abstract::Shape>()) { | ||||
| MS_EXCEPTION(ValueError) << "The " << arg_name << "'s shape is " << shape->ToString() | |||||
| << "should be a common shape!"; | |||||
| return std::vector<int64_t>(); | |||||
| } | } | ||||
| auto shape_element = shape->cast<abstract::ShapePtr>(); | auto shape_element = shape->cast<abstract::ShapePtr>(); | ||||
| MS_EXCEPTION_IF_NULL(shape_element); | MS_EXCEPTION_IF_NULL(shape_element); | ||||
| @@ -500,7 +499,7 @@ TypePtr CheckAndConvertUtils::_CheckTypeSame(const std::map<std::string, TypePtr | |||||
| MS_EXCEPTION_IF_NULL(type); | MS_EXCEPTION_IF_NULL(type); | ||||
| if (!allow_mix) { | if (!allow_mix) { | ||||
| // input must be all tensor or all other type | // input must be all tensor or all other type | ||||
| if (!(tensor_flag ^ type->isa<TensorType>())) { | |||||
| if (tensor_flag ^ type->isa<TensorType>()) { | |||||
| buffer << "For " << prim_name << "'s " | buffer << "For " << prim_name << "'s " | ||||
| << "type is not same"; | << "type is not same"; | ||||
| for (const auto &error_elem : args) { | for (const auto &error_elem : args) { | ||||
| @@ -208,7 +208,7 @@ class CheckAndConvertUtils { | |||||
| MS_EXCEPTION(NotExistsError) << "compare_operator " << compare_operator << " cannot find in the compare map"; | MS_EXCEPTION(NotExistsError) << "compare_operator " << compare_operator << " cannot find in the compare map"; | ||||
| } | } | ||||
| if (range.first >= range.second) { | 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; | << "," << range.second; | ||||
| } | } | ||||
| if (iter->second(arg_value, range)) { | if (iter->second(arg_value, range)) { | ||||
| @@ -227,7 +227,8 @@ class CheckAndConvertUtils { | |||||
| << " cannot find in the compare string map"; | << " cannot find in the compare string map"; | ||||
| } | } | ||||
| auto range_strng = iter_to_string->second; | 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(); | MS_EXCEPTION(ValueError) << buffer.str(); | ||||
| } | } | ||||