Skip to content

OpenVINO™ is an open source toolkit for optimizing and deploying AI inference

NPU: Don't update command list if set_tensor is called with the same tensor (#27239)

Dmitry Matveeva4f4e78b8167
diff --git a/src/plugins/intel_npu/src/backend/src/zero_infer_request.cpp b/src/plugins/intel_npu/src/backend/src/zero_infer_request.cpp
index 0a55945872b..dd2629372dc 100644
--- a/src/plugins/intel_npu/src/backend/src/zero_infer_request.cpp
+++ b/src/plugins/intel_npu/src/backend/src/zero_infer_request.cpp
@@ -388,6 +388,10 @@ void ZeroInferRequest::set_tensor(const ov::Output<const ov::Node>& port, const
}
if (foundPort.is_input()) {
+ if (get_user_input(foundPort.idx)._ptr == tensor._ptr) {
+ // Got set_tensor with the same object - do nothing
+ return;
+ }
if (is_batched_input(foundPort.idx)) {
// resize vector size to 1 if set_tensor is called after set_tensors
get_input_tensors_data(foundPort.idx).resize(1);
@@ -397,6 +401,10 @@ void ZeroInferRequest::set_tensor(const ov::Output<const ov::Node>& port, const
get_user_input(foundPort.idx) = tensor;
} else {
+ if (_userOutputTensors.at(foundPort.idx)._ptr == tensor._ptr) {
+ // Got set_tensor with the same object here too - do nothing
+ return;
+ }
_userOutputTensors.at(foundPort.idx) = tensor;
}