forked from mindspore-Ecosystem/mindspore
!14381 Fix errors in check_convert_utils
From: @liangzhibo Reviewed-by: @ginfung,@zh_qh Signed-off-by: @zh_qh
This commit is contained in:
commit
c4f30c6e1d
|
@ -389,8 +389,7 @@ std::vector<int64_t> CheckAndConvertUtils::ConvertShapePtrToShape(const std::str
|
|||
const std::string &prim_name) {
|
||||
MS_EXCEPTION_IF_NULL(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>();
|
||||
MS_EXCEPTION_IF_NULL(shape_element);
|
||||
|
@ -500,7 +499,7 @@ TypePtr CheckAndConvertUtils::_CheckTypeSame(const std::map<std::string, TypePtr
|
|||
MS_EXCEPTION_IF_NULL(type);
|
||||
if (!allow_mix) {
|
||||
// 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 "
|
||||
<< "type is not same";
|
||||
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";
|
||||
}
|
||||
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();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue