diff --git a/mindspore/ccsrc/session/kernel_graph.cc b/mindspore/ccsrc/session/kernel_graph.cc index 2b719ade05ac52ba2dd94b715e456e5b319e2953..c8cc6fbbee7e1e958e54ef1fc25b1f3aa963fa48 100644 --- a/mindspore/ccsrc/session/kernel_graph.cc +++ b/mindspore/ccsrc/session/kernel_graph.cc @@ -748,6 +748,10 @@ bool KernelGraph::RemoveValueNodeFromGraph(const ValueNodePtr &value_node) { void KernelGraph::ReplaceNode(NotNull old_anf_node, NotNull new_anf_node) { MS_EXCEPTION_IF_NULL(inputs_); + { + std::queue seed_nodes; + UpdateNodeEdgeList(&seed_nodes); + } auto it = node_output_edges_.find(old_anf_node); if (it != node_output_edges_.end()) { const auto &outputs = it->second; @@ -778,8 +782,10 @@ void KernelGraph::ReplaceNode(NotNull old_anf_node, NotNull seed_nodes; + UpdateNodeEdgeList(&seed_nodes); + } // update graph inputs in child graph auto it_real_inputs = std::find_if(real_inputs_.begin(), real_inputs_.end(), [&old_anf_node](const std::pair> &n) -> bool {