From 985772c192d8755f0ccddd2183ced38cabba3c73 Mon Sep 17 00:00:00 2001 From: buxue Date: Mon, 4 Jan 2021 09:41:29 +0800 Subject: [PATCH] fix bug when MixedPrecisionCast op return a tuple with many elements --- mindspore/ccsrc/pipeline/pynative/pynative_execute.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mindspore/ccsrc/pipeline/pynative/pynative_execute.cc b/mindspore/ccsrc/pipeline/pynative/pynative_execute.cc index b8934da3f1..912300337e 100644 --- a/mindspore/ccsrc/pipeline/pynative/pynative_execute.cc +++ b/mindspore/ccsrc/pipeline/pynative/pynative_execute.cc @@ -569,7 +569,11 @@ py::object RunOp(const py::args &args) { py::object PynativeExecutor::RunOpInner(const OpExecInfoPtr &op_exec_info) { MS_EXCEPTION_IF_NULL(op_exec_info); 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. abstract::AbstractBasePtrList args_spec_list;