!10906 fix bug when MixedPrecisionCast op return a tuple with many element

From: @zhangbuxue
Reviewed-by: @chujinjin,@zh_qh
Signed-off-by: @zh_qh
This commit is contained in:
mindspore-ci-bot 2021-01-04 11:42:53 +08:00 committed by Gitee
commit e6f80d6f40
1 changed files with 5 additions and 1 deletions

View File

@ -569,7 +569,11 @@ py::object RunOp(const py::args &args) {
py::object PynativeExecutor::RunOpInner(const OpExecInfoPtr &op_exec_info) { py::object PynativeExecutor::RunOpInner(const OpExecInfoPtr &op_exec_info) {
MS_EXCEPTION_IF_NULL(op_exec_info); MS_EXCEPTION_IF_NULL(op_exec_info);
if (op_exec_info->op_name == prim::kPrimMixedPrecisionCast->name()) { if (op_exec_info->op_name == prim::kPrimMixedPrecisionCast->name()) {
return RunOpWithInitBackendPolicy(op_exec_info)[0]; py::tuple ret = RunOpWithInitBackendPolicy(op_exec_info);
if (ret.size() == 1) {
return ret[0];
}
return std::move(ret);
} }
// make cnode for building grad graph if grad flag is set. // make cnode for building grad graph if grad flag is set.
abstract::AbstractBasePtrList args_spec_list; abstract::AbstractBasePtrList args_spec_list;