From 279091fa7504b9582f0e06a7bea396fe4605b011 Mon Sep 17 00:00:00 2001 From: limingqi107 Date: Thu, 1 Jul 2021 16:19:40 +0800 Subject: [PATCH] fix the multi outputs of value node --- mindspore/ccsrc/backend/session/anf_runtime_algorithm.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mindspore/ccsrc/backend/session/anf_runtime_algorithm.cc b/mindspore/ccsrc/backend/session/anf_runtime_algorithm.cc index 2e20760856b..79239bfd182 100644 --- a/mindspore/ccsrc/backend/session/anf_runtime_algorithm.cc +++ b/mindspore/ccsrc/backend/session/anf_runtime_algorithm.cc @@ -323,13 +323,17 @@ std::vector AnfRuntimeAlgorithm::GetAllOutputWithIndex(const An const std::vector return_types = {prim::kPrimDepend, prim::kPrimMakeTuple}; size_t outputs_num = 1; - if (IsRealCNodeKernel(node)) { + // Value node may be tuple which has multi outputs. + if (IsRealCNodeKernel(node) || node->isa()) { outputs_num = AnfAlgo::GetOutputTensorNum(node); } // The output may be the tuple of node, so need visit all the outputs of node. for (size_t i = 0; i < outputs_num; ++i) { - const auto &output_with_index = AnfAlgo::VisitKernelWithReturnType(node, i, false, return_types); + auto output_with_index = AnfAlgo::VisitKernelWithReturnType(node, i, false, return_types); MS_EXCEPTION_IF_NULL(output_with_index.first); + if (node->isa()) { + output_with_index.second = i; + } // The depend and makeTuple node need recurse. if (AnfAlgo::CheckPrimitiveType(output_with_index.first, prim::kPrimDepend) ||