Skip to content

Commit 4db7053

Browse files
authored
[FE] Coverity move instead of copy fix (#33582)
### Details: Fix Coverity defect type: Variable copied when it could be moved, for: src/frontends/pytorch/src/op/loop.cpp Coiverity issues id: - 2536356 - 2536355 - 2536354 - 2536353 - 2536352 ### Tickets: - *ticket-id*
1 parent d5f1d6a commit 4db7053

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/frontends/pytorch/src/op/loop.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,14 +145,14 @@ OutputVector translate_while_loop_fx(const NodeContext& context) {
145145
// counter
146146
auto loop_counter = std::make_shared<ov::opset10::Parameter>(ov::element::i64, ov::PartialShape{});
147147
loop_counter->set_friendly_name("loop_iteration");
148-
loop_body_params.push_back(loop_counter);
148+
loop_body_params.push_back(std::move(loop_counter));
149149

150150
// carried inputs
151151
for (size_t i = 0; i < num_carried; i++) {
152152
auto param =
153153
std::make_shared<ov::opset10::Parameter>(inputs[i].get_element_type(), inputs[i].get_partial_shape());
154154
param->set_friendly_name("loop_carried_" + std::to_string(i));
155-
loop_body_params.push_back(param);
155+
loop_body_params.push_back(std::move(param));
156156
}
157157

158158
// Map body model parameters to loop body parameters
@@ -238,7 +238,7 @@ OutputVector translate_while_loop_fx(const NodeContext& context) {
238238
auto cloned = op->clone_with_new_inputs(new_inputs);
239239
cloned->set_friendly_name(op->get_friendly_name() + "_cond");
240240
cond_cloned_map[op.get()] = cloned.get();
241-
body_ops.push_back(cloned);
241+
body_ops.push_back(std::move(cloned));
242242
}
243243

244244
// Get condition output
@@ -287,7 +287,7 @@ OutputVector translate_while_loop_fx(const NodeContext& context) {
287287
OutputVector outputs;
288288
for (size_t i = 0; i < num_carried; i++) {
289289
auto out = loop->get_iter_value(loop_body_results[i + 1], -1);
290-
outputs.push_back(out);
290+
outputs.push_back(std::move(out));
291291
}
292292

293293
context.mark_node(loop);

0 commit comments

Comments
 (0)