Browse Source

Fix arg index check error when return Parameter defined in Net directly

tags/v0.5.0-beta
fary86 5 years ago
parent
commit
faf6578a90
1 changed files with 3 additions and 2 deletions
  1. +3
    -2
      mindspore/ccsrc/utils/convert_utils.cc

+ 3
- 2
mindspore/ccsrc/utils/convert_utils.cc View File

@@ -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"; MS_EXCEPTION(UnknownError) << "When graph output is Parameter, it should be found in graph parameters";
} }
size_t index = it - params.cbegin(); 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]; *ret_val = args[index];
return true; return true;


Loading…
Cancel
Save