modified: ge/graph/passes/no_use_reshape_remove_pass.cc

pull/1137/head
zhaoxinxin 4 years ago
parent 0c9ef67cc7
commit 263f43abe4

@ -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