Browse Source

modified: ge/graph/passes/no_use_reshape_remove_pass.cc

tags/v1.2.0
zhaoxinxin 3 years ago
parent
commit
263f43abe4
1 changed files with 11 additions and 4 deletions
  1. +11
    -4
      ge/graph/passes/no_use_reshape_remove_pass.cc

+ 11
- 4
ge/graph/passes/no_use_reshape_remove_pass.cc View File

@@ -83,10 +83,17 @@ Status NoUseReshapeRemovePass::Run(ge::NodePtr &node) {
}
if (to_be_deleted) {
GELOGI("NoUseReshapeRemovePass remove useless node:%s", node->GetName().c_str());
auto ret = PassUtils::UnlinkNodeWithControlCopy(node, kReshapeShapeIndex);
if (ret != SUCCESS) {
GELOGE(ret, "DimensionAdjustPass unlink node with control copy fail.");
return ret;
// if shape_input has no any input,which means a single const, it can be unlink from reshape
// op(x) const(shape)
// \ /
// reshape
auto shape_input_anchor = node->GetInDataAnchor(kReshapeShapeIndex);
if (shape_input_anchor != nullptr) {
auto shape_input = shape_input_anchor->GetOwnerNode();
GE_CHECK_NOTNULL(shape_input);
if (shape_input->GetInAllNodes().empty()) {
shape_input_anchor->UnlinkAll();
}
}
return IsolateAndDeleteNode(node, {kReshapeDataIndex});
}


Loading…
Cancel
Save