From 81206de6e7e500ee1d0374a6a62a9376a2364672 Mon Sep 17 00:00:00 2001 From: mengyuanli Date: Wed, 27 Jan 2021 11:11:24 +0800 Subject: [PATCH] fix bug of nested loop expand --- .../legacy_optimizer/graph/nested_loop_expand_pass.cc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/mindspore/lite/tools/converter/legacy_optimizer/graph/nested_loop_expand_pass.cc b/mindspore/lite/tools/converter/legacy_optimizer/graph/nested_loop_expand_pass.cc index bfb553020c..7742ddd216 100644 --- a/mindspore/lite/tools/converter/legacy_optimizer/graph/nested_loop_expand_pass.cc +++ b/mindspore/lite/tools/converter/legacy_optimizer/graph/nested_loop_expand_pass.cc @@ -77,14 +77,17 @@ STATUS NestedLoopExpandPass::Run(schema::MetaGraphT *graph) { graph_->subGraph.at(idx) = nullptr; } - - for (auto &node_idx : main_graph->nodeIndices) { auto &node = graph_->nodes.at(node_idx); if (node->primitive->value.type == PrimitiveType_Partial) { auto &subgraph_idx = ((schema::PartialT *)(node->primitive->value.value))->subGraphIndex; - for (auto i = 0; i < subgraph_idx; ++i) { - if (graph_->subGraph.at(subgraph_idx) == nullptr) { + if (graph_->subGraph.at(subgraph_idx) == nullptr) { + node = nullptr; + continue; + } + auto tmp_subgraph_idx = subgraph_idx; + for (auto i = 0; i < tmp_subgraph_idx; ++i) { + if (graph_->subGraph.at(i) == nullptr) { subgraph_idx--; } }