From 14d24d47934b1bd6a6d7a601ea983726b15b2ce3 Mon Sep 17 00:00:00 2001 From: "7347157+joylvliang@user.noreply.gitee.com" Date: Thu, 2 Sep 2021 16:07:31 +0800 Subject: [PATCH] update_bprop_error_information --- mindspore/ccsrc/pipeline/pynative/pynative_execute.cc | 3 +-- tests/ut/python/pynative_mode/test_user_define_bprop_check.py | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/mindspore/ccsrc/pipeline/pynative/pynative_execute.cc b/mindspore/ccsrc/pipeline/pynative/pynative_execute.cc index c5191c2c2c3..643aa843cc5 100644 --- a/mindspore/ccsrc/pipeline/pynative/pynative_execute.cc +++ b/mindspore/ccsrc/pipeline/pynative/pynative_execute.cc @@ -2367,8 +2367,7 @@ void GradExecutor::DoGradForCustomBprop(const py::object &cell, const py::object MS_LOG(DEBUG) << "Do grad for custom bprop"; size_t par_number = py::tuple(parse::python_adapter::CallPyObjMethod(cell, "get_parameters")).size(); if (par_number > 0) { - MS_LOG(EXCEPTION) << "When user defines the net bprop, there are " << par_number - << " parameters that is not supported in the net."; + MS_LOG(EXCEPTION) << "When user defines the net bprop, the 'Parameter' data type is not supported in the net."; } py::function bprop_func = py::getattr(cell, parse::CUSTOM_BPROP_NAME); auto bprop_func_cellid = GetId(bprop_func); diff --git a/tests/ut/python/pynative_mode/test_user_define_bprop_check.py b/tests/ut/python/pynative_mode/test_user_define_bprop_check.py index c252d8a6ab1..9e1581ca120 100644 --- a/tests/ut/python/pynative_mode/test_user_define_bprop_check.py +++ b/tests/ut/python/pynative_mode/test_user_define_bprop_check.py @@ -177,7 +177,7 @@ def test_user_define_bprop_check_parameter(): grad_net = GradNet(net) with pytest.raises(RuntimeError) as ex: ret = grad_net(x, sens) - assert "When user defines the net bprop, there are 1 parameters that is not supported in the net." in str(ex.value) + assert "When user defines the net bprop, the 'Parameter' data type is not supported in the net." in str(ex.value) def test_user_define_bprop_check_number():