!37309 fix implicitly converted error log for master

Merge pull request !37309 from chujinjin/fix_error_log_for_master
This commit is contained in:
i-robot 2022-07-06 01:48:43 +00:00 committed by Gitee
commit ff86996b45
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 3 additions and 3 deletions

View File

@ -1863,8 +1863,8 @@ void ForwardExecutor::DoSignatureCast(const PrimitivePyPtr &prim,
}
if (IsPyObjTypeInvalid(obj)) {
MS_EXCEPTION(TypeError) << "For '" << prim->name() << "', the " << i << "th input " << signature[i].name
<< " is a not support implicit conversion. "
MS_EXCEPTION(TypeError) << "For '" << prim->name() << "', the " << (i + 1) << "th input " << signature[i].name
<< " can not be implicitly converted. "
<< "Its type is " << py::cast<std::string>(obj.attr("__class__").attr("__name__"))
<< ", and the value is " << py::cast<py::str>(obj) << ". Only support Tensor or Scalar.";
}

View File

@ -111,7 +111,7 @@ def test_float_tensor_and_str_add():
y = "ok"
with pytest.raises(TypeError) as er:
ret = x + y
assert "For 'Add', the 1th input var is a not support implicit conversion. Its type is" in str(er.value)
assert "For 'Add', the 2th input var can not be implicitly converted. Its type is" in str(er.value)
def test_float_tensor_and_tuple_add():