Skip to content

Commit d7370f6

Browse files
committed
update
1 parent 2fd18af commit d7370f6

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

paddle/cinn/operator_fusion/pattern_graph.cc

+5-4
Original file line numberDiff line numberDiff line change
@@ -284,14 +284,15 @@ PatternGraph::PatternGraph(const std::vector<PatternContent>& contents,
284284

285285
void PatternGraph::RemoveNode(const PatternNodePtr& node) {
286286
VLOG(4) << "Start Remove: " << node->id() << "(" << node << ")";
287-
for (const auto& n : all_pattern_nodes_) {
287+
for (auto it = all_pattern_nodes_.begin(); it != all_pattern_nodes_.end();
288+
++it) {
288289
// Here we use traversal instead of count() or find() builtin function
289290
// because all_pattern_nodes_ is sorted by node id when initialization
290291
// but node id may be changed in copy instruction that may destroy the
291292
// order of set.
292-
if (n->id() == node->id()) {
293-
VLOG(4) << "Removed " << n->id();
294-
all_pattern_nodes_.erase(n);
293+
if ((*it)->id() == node->id()) {
294+
VLOG(4) << "Removed " << (*it)->id();
295+
all_pattern_nodes_.erase(it);
295296
break;
296297
}
297298
}

0 commit comments

Comments
 (0)