!7223 Fix rebuilding nodes when eliminating redundant op

Merge pull request !7223 from YuJianfeng/master
This commit is contained in:
mindspore-ci-bot 2020-10-13 15:06:45 +08:00 committed by Gitee
commit 9078764c58
1 changed files with 6 additions and 2 deletions

View File

@ -107,8 +107,12 @@ const AnfNodePtr ProcessMatchedNodes(const FuncGraphPtr &func_graph, const CNode
} else { // rebuild the pass nodes
for (size_t idx = pass_size - 2; idx > 0; --idx) {
auto new_node = func_graph->NewCNode((*pass_vector)[idx].first->inputs());
new_node->set_input((*pass_vector)[idx].second,
(*pass_vector)[idx + 1].first->input((*pass_vector)[idx + 1].second));
if (idx == pass_size - 2) {
new_node->set_input((*pass_vector)[idx].second,
(*pass_vector)[idx + 1].first->input((*pass_vector)[idx + 1].second));
} else {
new_node->set_input((*pass_vector)[idx].second, (*pass_vector)[idx + 1].first);
}
(*pass_vector)[idx].first = new_node;
}
return (*pass_vector)[1].first;