@@ -58,8 +58,8 @@ c10::optional<at::ScalarType> get_value_first_calc_dtype_opt(torch::jit::Block*
58
58
auto consumers = in->uses ();
59
59
auto search_list = std::vector<torch::jit::Use>(consumers.begin (), consumers.end ());
60
60
61
- for (auto & u : search_list) {
62
- auto n = u. user ;
61
+ for (auto iter = search_list. begin (); iter != search_list. end (); ++iter ) {
62
+ auto n = iter-> user ;
63
63
LOG_GRAPH (" Node we are looking at: " << util::node_info (n));
64
64
auto ins = n->inputs ();
65
65
auto outs = n->outputs ();
@@ -94,7 +94,9 @@ c10::optional<at::ScalarType> get_value_first_calc_dtype_opt(torch::jit::Block*
94
94
for (auto o : outs) {
95
95
if (o->type () == c10::TensorType::get ()) {
96
96
auto o_uses = o->uses ();
97
+ int offset = iter - search_list.begin ();
97
98
search_list.insert (search_list.end (), o_uses.begin (), o_uses.end ());
99
+ iter = search_list.begin () + offset;
98
100
}
99
101
}
100
102
continue ;
@@ -123,7 +125,9 @@ c10::optional<at::ScalarType> get_value_first_calc_dtype_opt(torch::jit::Block*
123
125
for (auto o : outs) {
124
126
if (o->type () == c10::TensorType::get ()) {
125
127
auto o_uses = o->uses ();
128
+ int offset = iter - search_list.begin ();
126
129
search_list.insert (search_list.end (), o_uses.begin (), o_uses.end ());
130
+ iter = search_list.begin () + offset;
127
131
}
128
132
}
129
133
}
@@ -150,4 +154,4 @@ TypeMap get_block_first_calc_dtypes_opt(torch::jit::Block* b) {
150
154
151
155
} // namespace ir
152
156
} // namespace core
153
- } // namespace torch_tensorrt
157
+ } // namespace torch_tensorrt
0 commit comments