diff --git a/mindspore/ccsrc/session/kernel_graph.cc b/mindspore/ccsrc/session/kernel_graph.cc index 8bdb955f798d2db28392239d563e7145ef96d83d..9146bdc6229a8a6d8a157de55ba5b06e51f4bbc7 100755 --- a/mindspore/ccsrc/session/kernel_graph.cc +++ b/mindspore/ccsrc/session/kernel_graph.cc @@ -466,7 +466,7 @@ bool KernelGraph::HandleControlDependNode(const AnfNodePtr &node, std::queuefind(node) != visited_nodes->end()) { - MS_LOG(EXCEPTION) << "control depend[" << node->DebugString() << "] has been handled before"; + return true; } (void)visited_nodes->insert(cnode); // add a 0 depend num to keep the link relations to prepare for finding zero output nodes diff --git a/mindspore/ccsrc/session/session_basic.cc b/mindspore/ccsrc/session/session_basic.cc index c1dfda5ffb48d6c81b110cc94ae63e2a87222f5b..59ee4cc8708c7a0c6cf0fc7a73c62a5a042c6f87 100644 --- a/mindspore/ccsrc/session/session_basic.cc +++ b/mindspore/ccsrc/session/session_basic.cc @@ -68,7 +68,6 @@ void GetSummaryNodes(const KernelGraph *graph, std::unordered_mapcast(); MS_EXCEPTION_IF_NULL(cnode); if (cnode->inputs().size() <= kSummaryGetItem) { @@ -76,24 +75,11 @@ void GetSummaryNodes(const KernelGraph *graph, std::unordered_mapinput(kSummaryGetItem); MS_EXCEPTION_IF_NULL(node); - if (IsPrimitiveCNode(node, prim::kPrimTupleGetItem)) { - auto c = node->cast(); - MS_EXCEPTION_IF_NULL(c); - if (c->inputs().size() != kTupleGetItemInputSize) { - MS_LOG(EXCEPTION) << "the node tuple_get_item must have 2 inputs!"; - } - MS_EXCEPTION_IF_NULL(c->input(kInputNodeOutputIndexInTupleGetItem)); - auto value_node = c->input(kInputNodeOutputIndexInTupleGetItem)->cast(); - auto value = value_node->value(); - MS_EXCEPTION_IF_NULL(value); - Int32ImmPtr int_imm_ptr = value->cast(); - MS_EXCEPTION_IF_NULL(int_imm_ptr); - index = int_imm_ptr->value(); - node = c->input(kRealInputNodeIndexInTupleGetItem); + auto item_with_index = AnfAlgo::VisitKernelWithReturnType(node, 0); + if (!AnfAlgo::IsRealKernel(item_with_index.first)) { + MS_LOG(EXCEPTION) << "Unexpected node:" << item_with_index.first->DebugString(); } - std::pair output_pair(node, index); - // get full name with scope will add scalar or tensor or image summary tag. - (*summary)[n->fullname_with_scope()] = output_pair; + (*summary)[n->fullname_with_scope()] = item_with_index; } } MS_LOG(DEBUG) << "Update summary end size: " << (*summary).size();