@@ -241,13 +241,13 @@ void Graph::Replicate(const std::shared_ptr<const ov::Model>& model,
241
241
const auto & inputNode = input.second ;
242
242
const auto precToSet = inputNode->getOriginalOutputPrecisionAtPort (0 );
243
243
const auto childEdges = inputNode->getChildEdgesAtPort (0 );
244
- for (size_t i = 0 ; i < childEdges. size (); i++ ) {
245
- const auto child = childEdges[i] ->getChild ();
246
- const auto child_prec = child->getOriginalInputPrecisionAtPort (childEdges[i] ->getOutputNum ());
244
+ for (const auto & childEdge : childEdges) {
245
+ const auto child = childEdge ->getChild ();
246
+ const auto child_prec = child->getOriginalInputPrecisionAtPort (childEdge ->getOutputNum ());
247
247
if (!one_of (child_prec, ov::element::bf16, ov::element::f16) &&
248
248
// remove this WA when #78939 is resolved
249
249
!hasSubgraphConsumers (child)) {
250
- child->setOriginalInputPrecisionAtPort (childEdges[i] ->getOutputNum (), precToSet);
250
+ child->setOriginalInputPrecisionAtPort (childEdge ->getOutputNum (), precToSet);
251
251
}
252
252
}
253
253
}
@@ -631,9 +631,9 @@ void Graph::ResolveEdgeConflicts() {
631
631
632
632
/* When inserting convert / reorder, two new edges are added (pushed to the end) to the graphEdges.
633
633
So use a plain for loop, to handle newly inserted edges as well */
634
- for (size_t i = 0 ; i < graphEdges.size (); i++) {
634
+ for (size_t i = 0 ; i < graphEdges.size (); i++) { // NOLINT(modernize-loop-convert)
635
635
auto & edge = graphEdges[i];
636
- auto reorderStatus = edge->needReorder ();
636
+ auto reorderStatus = edge->needReorder (); // NOLINT(modernize-loop-convert)
637
637
DEBUG_LOG (*edge, " reorderStatus = " , reorderStatus);
638
638
639
639
switch (reorderStatus) {
@@ -1757,11 +1757,11 @@ void Graph::GetPerfData(std::vector<ov::ProfilingInfo>& perfMap) const {
1757
1757
}
1758
1758
};
1759
1759
1760
- for (size_t i = 0 ; i < graphNodes. size (); i++ ) {
1761
- if (graphNodes[i] ->isConstant ()) {
1760
+ for (const auto & graphNode : graphNodes) {
1761
+ if (graphNode ->isConstant ()) {
1762
1762
continue ;
1763
1763
}
1764
- getPerfMapFor (perfMap, graphNodes[i] );
1764
+ getPerfMapFor (perfMap, graphNode );
1765
1765
}
1766
1766
}
1767
1767
@@ -1793,7 +1793,8 @@ void Graph::DropNode(const NodePtr& node) {
1793
1793
auto children = node->childEdges ;
1794
1794
auto parents = node->parentEdges ;
1795
1795
1796
- for (size_t i = 0 ; i < parents.size (); i++) {
1796
+ // The collections are being updated while iterating. So, range based for loops cannot be used.
1797
+ for (size_t i = 0 ; i < parents.size (); i++) { // NOLINT(modernize-loop-convert)
1797
1798
auto p_edge = parents[i].lock ();
1798
1799
if (!p_edge) {
1799
1800
continue ;
@@ -1806,7 +1807,8 @@ void Graph::DropNode(const NodePtr& node) {
1806
1807
const int inNum = p_edge->getInputNum ();
1807
1808
RemoveEdge (p_edge);
1808
1809
1809
- for (size_t j = 0 ; j < children.size (); j++) {
1810
+ // The collections are being updated while iterating. So, range based for loops cannot be used.
1811
+ for (size_t j = 0 ; j < children.size (); j++) { // NOLINT(modernize-loop-convert)
1810
1812
auto c_edge = children[j].lock ();
1811
1813
if (!c_edge) {
1812
1814
continue ;
@@ -1851,7 +1853,8 @@ void Graph::DropDWConvNode(const NodePtr& node) {
1851
1853
const int inNum = p_edge->getInputNum ();
1852
1854
RemoveEdge (p_edge);
1853
1855
1854
- for (size_t j = 0 ; j < children.size (); j++) {
1856
+ // The collections are being updated while iterating. So, range based for loops cannot be used.
1857
+ for (size_t j = 0 ; j < children.size (); j++) { // NOLINT(modernize-loop-convert)
1855
1858
auto c_edge = children[j].lock ();
1856
1859
if (!c_edge) {
1857
1860
continue ;
0 commit comments