diff --git a/mindspore/ccsrc/utils/convert_utils.cc b/mindspore/ccsrc/utils/convert_utils.cc index 411a15c971b8063a8fa256e39f8059fd63c7fdbc..f64192f1d2cf12fedcdbbdc0f20410bc84bfc6cc 100644 --- a/mindspore/ccsrc/utils/convert_utils.cc +++ b/mindspore/ccsrc/utils/convert_utils.cc @@ -30,6 +30,7 @@ #include "pipeline/parse/parse_base.h" #include "ir/value.h" #include "ir/tensor.h" +#include "ir/param_value_py.h" #include "utils/base_ref_extends.h" namespace mindspore { @@ -425,7 +426,17 @@ bool IsGraphOutputValueNodeOrParameter(const AnfNodePtr &output, const py::tuple if (index >= args.size()) { MS_EXCEPTION(UnknownError) << "Index " << index << " equal or larger than args size " << args.size() << "."; } - *ret_val = args[index]; + if (index < args.size()) { + *ret_val = args[index]; + } else { + auto param = dyn_cast(params[index]); + MS_EXCEPTION_IF_NULL(param); + if (!param->has_default()) { + MS_LOG(EXCEPTION) << "Can not determine value of Parameter " << index << " (" << param->name() << ")"; + } + auto param_value = std::dynamic_pointer_cast(param->default_param()); + *ret_val = param_value->value().attr("data"); + } return true; } return false;