From 456092b3b0b365b5b6dab59cf3f72f1cbeb08f5a Mon Sep 17 00:00:00 2001 From: chujinjin Date: Tue, 5 Jul 2022 14:37:07 +0800 Subject: [PATCH] fix implicityly converted log error --- mindspore/ccsrc/pipeline/pynative/pynative_execute.cc | 4 ++-- tests/ut/python/pynative_mode/test_implicit_conversion.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mindspore/ccsrc/pipeline/pynative/pynative_execute.cc b/mindspore/ccsrc/pipeline/pynative/pynative_execute.cc index 1e2b6c4eeb2..d9dc5cb1e30 100644 --- a/mindspore/ccsrc/pipeline/pynative/pynative_execute.cc +++ b/mindspore/ccsrc/pipeline/pynative/pynative_execute.cc @@ -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(obj.attr("__class__").attr("__name__")) << ", and the value is " << py::cast(obj) << ". Only support Tensor or Scalar."; } diff --git a/tests/ut/python/pynative_mode/test_implicit_conversion.py b/tests/ut/python/pynative_mode/test_implicit_conversion.py index d92868415d9..05949114d1d 100644 --- a/tests/ut/python/pynative_mode/test_implicit_conversion.py +++ b/tests/ut/python/pynative_mode/test_implicit_conversion.py @@ -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():