Skip to content

Commit b91c1c9

Browse files
committed
fix: [collection] solve confict in ir.cpp
Signed-off-by: inocsin <[email protected]>
1 parent 5fdef1c commit b91c1c9

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

core/ir/ir.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,8 @@ c10::optional<at::ScalarType> get_value_first_calc_dtype_opt(torch::jit::Block*
102102
auto consumers = in->uses();
103103
auto search_list = std::vector<torch::jit::Use>(consumers.begin(), consumers.end());
104104

105-
while(search_list.size() > 0) {
106-
// after insertion, original iterator will be invalid
107-
auto& u = search_list.front();
108-
search_list.erase(search_list.begin());
109-
auto n = u.user;
105+
for (auto iter = search_list.begin(); iter != search_list.end(); ++iter) {
106+
auto n = iter->user;
110107
LOG_GRAPH("Node we are looking at: " << util::node_info(n));
111108
auto ins = n->inputs();
112109
auto outs = n->outputs();

0 commit comments

Comments
 (0)