Skip to content

Commit db00773

Browse files
committed
changed from iterator-based access to indexed access to prevent iterator invalidation
1 parent 35d0192 commit db00773

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/plugins/intel_cpu/src/graph_optimizer.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2250,11 +2250,10 @@ void GraphOptimizer::ShareReorders(Graph& graph) {
22502250
void GraphOptimizer::DropDoubleReorders(Graph& graph) {
22512251
std::set<NodePtr> processed;
22522252

2253-
const auto& nodes = graph.GetNodes();
2254-
for (const auto& node : nodes) {
2255-
if (!node) {
2256-
continue;
2257-
}
2253+
auto& nodes = graph.GetNodes();
2254+
for (size_t i = 0; i < nodes.size(); ++i) { // NOLINT(modernize-loop-convert)
2255+
auto node = nodes[i];
2256+
22582257
if (processed.find(node) == processed.end() && node->getType() == Type::Reorder &&
22592258
node->getChildEdges().size() == 1 && node->getChildEdgeAt(0)->getChild()->getType() == Type::Reorder) {
22602259
auto nextNode = node->getChildEdgeAt(0)->getChild();

0 commit comments

Comments
 (0)