From 8456a762e5eb95a418b9bbb02fcdfcd7d2e1d5b4 Mon Sep 17 00:00:00 2001 From: jiaorui Date: Tue, 31 Jan 2023 09:20:16 +0800 Subject: [PATCH] fix bug of identity and noop --- mindspore/ccsrc/transform/graph_ir/convert.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mindspore/ccsrc/transform/graph_ir/convert.cc b/mindspore/ccsrc/transform/graph_ir/convert.cc index 086cf253ab3..b436b7636ca 100644 --- a/mindspore/ccsrc/transform/graph_ir/convert.cc +++ b/mindspore/ccsrc/transform/graph_ir/convert.cc @@ -2236,7 +2236,7 @@ void DfGraphConvertor::RemoveIdentity(::ge::GNode identity_node) { void DfGraphConvertor::IdentityOptimization() { MS_LOG(INFO) << "Start IdentityOptimization, graph: " << anf_graph_->ToString(); MS_EXCEPTION_IF_NULL(df_graph_); - auto all_nodes = df_graph_->GetAllNodes(); + auto all_nodes = df_graph_->GetDirectNode(); for (const auto &node : all_nodes) { if (IsIdentityRedundant(node)) { RemoveIdentity(node); @@ -2248,7 +2248,7 @@ void DfGraphConvertor::IdentityOptimization() { void DfGraphConvertor::NoOpOptimization() { MS_LOG(INFO) << "Start NoOpOptimization, graph:" << anf_graph_->ToString(); MS_EXCEPTION_IF_NULL(df_graph_); - auto all_nodes = df_graph_->GetAllNodes(); + auto all_nodes = df_graph_->GetDirectNode(); for (const auto &node : all_nodes) { if (IsNoOpRedundant(node)) { RemoveNoOp(node);