Browse Source

rm empty_tensor inputs for merge

tags/v1.1.0
chenyemeng 3 years ago
parent
commit
ec4ada340a
1 changed files with 9 additions and 3 deletions
  1. +9
    -3
      ge/graph/passes/merge_pass.cc

+ 9
- 3
ge/graph/passes/merge_pass.cc View File

@@ -219,12 +219,18 @@ Status MergePass::OptimizeEmptyTensorInput(const NodePtr &node) {
if (peer_data_anchor == nullptr) { if (peer_data_anchor == nullptr) {
continue; 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; continue;
} }
const auto &op_desc = peer_data_anchor->GetOwnerNode()->GetOpDesc();
if (IsEmptyTensor(op_desc->GetOutputDesc(peer_data_anchor->GetIdx()).GetShape())) { 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; return SUCCESS;


Loading…
Cancel
Save