提交 340bb4c2 编写于 作者: M mindspore-ci-bot 提交者: Gitee

!5573 Fix wrong graph inputs bug

Merge pull request !5573 from fanglei/graphclone
......@@ -336,7 +336,14 @@ void Cloner::AddInputs(const FuncGraphPtr &func_graph_user, const FuncGraphPtr &
}
auto cnode = node->cast<CNodePtr>();
auto inputs = cnode->inputs();
(void)std::copy(params.begin(), params.end(), std::back_inserter(inputs));
std::vector<AnfNodePtr> add_params{params.begin(), params.end()};
for (size_t i = 2; i < inputs.size(); i++) {
auto ret = std::find(add_params.begin(), add_params.end(), inputs[i]);
if (ret != add_params.end()) {
add_params.erase(ret);
}
}
(void)std::copy(add_params.begin(), add_params.end(), std::back_inserter(inputs));
cnode->set_inputs(inputs);
OrderParameters(func_graph, inputs);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册