提交 e3585ff5 编写于 作者: F fary86

Fix return paramter directly in net

上级 179ca1ea
......@@ -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<Parameter>(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<ParamValuePy>(param->default_param());
*ret_val = param_value->value().attr("data");
}
return true;
}
return false;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册