From 6665684a1803b56d964f806a1bf48aa874c0c7ca Mon Sep 17 00:00:00 2001 From: zengzitao Date: Thu, 29 Oct 2020 20:41:32 +0800 Subject: [PATCH] delete sub_graph_changed to avoid resetkernelinfo cause error --- .../backend/optimizer/graph_kernel/arithmetic_simplify.cc | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/mindspore/ccsrc/backend/optimizer/graph_kernel/arithmetic_simplify.cc b/mindspore/ccsrc/backend/optimizer/graph_kernel/arithmetic_simplify.cc index 83df87c285f..3b541bedc60 100644 --- a/mindspore/ccsrc/backend/optimizer/graph_kernel/arithmetic_simplify.cc +++ b/mindspore/ccsrc/backend/optimizer/graph_kernel/arithmetic_simplify.cc @@ -37,6 +37,7 @@ AnfNodePtr NewCNodeWithInfo(const AnfNodePtrList &inputs, const AnfNodePtr &ori_ } else { ResetKernelInfo(new_cnode, UNKNOWN_KERNEL_TYPE); } + func_graph->AddNode(new_cnode); return new_cnode; } @@ -768,17 +769,12 @@ bool ArithmeticSimplify::Run(const FuncGraphPtr &func_graph) { mng_sub = Manage(sub_graph, false); sub_graph->set_manager(mng_sub); } - bool sub_graph_changed = false; for (auto node_sub : sub_graph->GetOrderedCnodes()) { auto new_node = TrySimplify(node_sub); if (new_node != nullptr) { - sub_graph_changed = true; PERFORM_REPLACE(node_sub->cast(), new_node, sub_graph, replaced); } } - if (sub_graph_changed) { - ResetKernelInfo(node, AKG_KERNEL); - } } else { auto new_node = TrySimplify(node); PERFORM_REPLACE(node->cast(), new_node, func_graph, replaced);