From faf6578a9060b1adfa35de9ce7da6652e971ece7 Mon Sep 17 00:00:00 2001 From: fary86 Date: Sat, 30 May 2020 11:31:28 +0800 Subject: [PATCH] Fix arg index check error when return Parameter defined in Net directly --- mindspore/ccsrc/utils/convert_utils.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mindspore/ccsrc/utils/convert_utils.cc b/mindspore/ccsrc/utils/convert_utils.cc index 411a15c971..6dff365504 100644 --- a/mindspore/ccsrc/utils/convert_utils.cc +++ b/mindspore/ccsrc/utils/convert_utils.cc @@ -422,8 +422,9 @@ bool IsGraphOutputValueNodeOrParameter(const AnfNodePtr &output, const py::tuple MS_EXCEPTION(UnknownError) << "When graph output is Parameter, it should be found in graph parameters"; } size_t index = it - params.cbegin(); - if (index >= args.size()) { - MS_EXCEPTION(UnknownError) << "Index " << index << " equal or larger than args size " << args.size() << "."; + if (index >= args.size() + func_graph->hyper_param_count()) { + MS_EXCEPTION(UnknownError) << "Index " << index << " equal or larger than args size " << args.size() + << " add Parameter count " << func_graph->hyper_param_count() << "."; } *ret_val = args[index]; return true;