Skip to content

Commit 2fd18af

Browse files
committed
update
1 parent 422c5d4 commit 2fd18af

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

paddle/cinn/operator_fusion/pattern_graph.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,10 @@ PatternGraph::PatternGraph(const std::vector<PatternContent>& contents,
285285
void PatternGraph::RemoveNode(const PatternNodePtr& node) {
286286
VLOG(4) << "Start Remove: " << node->id() << "(" << node << ")";
287287
for (const auto& n : all_pattern_nodes_) {
288+
// Here we use traversal instead of count() or find() builtin function
289+
// because all_pattern_nodes_ is sorted by node id when initialization
290+
// but node id may be changed in copy instruction that may destroy the
291+
// order of set.
288292
if (n->id() == node->id()) {
289293
VLOG(4) << "Removed " << n->id();
290294
all_pattern_nodes_.erase(n);
@@ -303,8 +307,6 @@ void PatternGraph::AppendNode(const PatternNodePtr& node) {
303307
all_pattern_nodes_.emplace(node);
304308
}
305309

306-
// void PatternGraph
307-
308310
std::string PatternGraph::GraphInfo() const {
309311
std::stringstream ss;
310312
ss << "\n========= GraphInfo ===========";

0 commit comments

Comments
 (0)