提交 807e4eb3 编写于 作者: M mindspore-ci-bot 提交者: Gitee

!3896 fix GetGraphInputNodes: remove duplicates elements

Merge pull request !3896 from sunsuodong/get_input_nodes
...@@ -34,7 +34,9 @@ std::vector<size_t> GetGraphInputNodes(const schema::MetaGraph *meta_graph) { ...@@ -34,7 +34,9 @@ std::vector<size_t> GetGraphInputNodes(const schema::MetaGraph *meta_graph) {
MS_ASSERT(nullptr != cNode); MS_ASSERT(nullptr != cNode);
for (size_t k = 0; k < cNode->inputIndex()->size(); k++) { for (size_t k = 0; k < cNode->inputIndex()->size(); k++) {
if (cNode->inputIndex()->GetAs<uint32_t>(k) == input_index) { if (cNode->inputIndex()->GetAs<uint32_t>(k) == input_index) {
ret.emplace_back(j); if (!IsContain<size_t>(ret, j)) {
ret.emplace_back(j);
}
break; break;
} }
} }
...@@ -53,7 +55,9 @@ std::vector<size_t> GetGraphOutputNodes(const schema::MetaGraph *meta_graph) { ...@@ -53,7 +55,9 @@ std::vector<size_t> GetGraphOutputNodes(const schema::MetaGraph *meta_graph) {
MS_ASSERT(nullptr != cNode); MS_ASSERT(nullptr != cNode);
for (size_t k = 0; k < cNode->outputIndex()->size(); k++) { for (size_t k = 0; k < cNode->outputIndex()->size(); k++) {
if (cNode->outputIndex()->GetAs<uint32_t>(k) == output_index) { if (cNode->outputIndex()->GetAs<uint32_t>(k) == output_index) {
ret.emplace_back(j); if (!IsContain<size_t>(ret, j)) {
ret.emplace_back(j);
}
break; break;
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册