From ec4ada340ac5f271c12ab5f52b889ebd40ea938d Mon Sep 17 00:00:00 2001 From: chenyemeng Date: Thu, 26 Nov 2020 15:22:53 +0800 Subject: [PATCH] rm empty_tensor inputs for merge --- ge/graph/passes/merge_pass.cc | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/ge/graph/passes/merge_pass.cc b/ge/graph/passes/merge_pass.cc index fb485e2b..a50893a9 100644 --- a/ge/graph/passes/merge_pass.cc +++ b/ge/graph/passes/merge_pass.cc @@ -219,12 +219,18 @@ Status MergePass::OptimizeEmptyTensorInput(const NodePtr &node) { if (peer_data_anchor == nullptr) { continue; } - const auto &op_desc = peer_data_anchor->GetOwnerNode()->GetOpDesc(); - if (op_desc == nullptr) { + if ((peer_data_anchor->GetOwnerNode() == nullptr) || + (peer_data_anchor->GetOwnerNode()->GetOpDesc() == nullptr)) { continue; } + const auto &op_desc = peer_data_anchor->GetOwnerNode()->GetOpDesc(); if (IsEmptyTensor(op_desc->GetOutputDesc(peer_data_anchor->GetIdx()).GetShape())) { - return GraphUtils::RemoveEdge(peer_data_anchor, in_data_anchor) == GRAPH_SUCCESS ? SUCCESS : FAILED; + if (GraphUtils::RemoveEdge(peer_data_anchor, in_data_anchor) != GRAPH_SUCCESS) { + GELOGE(FAILED, "Remove data edge %s:%d->%s:%d failed.", + op_desc->GetName().c_str(), peer_data_anchor->GetIdx(), + node->GetName().c_str(), in_data_anchor->GetIdx()); + return FAILED; + } } } return SUCCESS;