Skip to content

Commit

Permalink
Revert "fix psa psr accuracy issue"
Browse files Browse the repository at this point in the history
This reverts commit 60af873.
  • Loading branch information
saurabhkale17 committed Sep 25, 2024
1 parent 465a52c commit 4d64dc0
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions onnxruntime/core/providers/openvino/backends/basic_backend.cc
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,9 @@ void BasicBackend::StartAsyncInference(Ort::KernelContext& context, OVInferReque
auto allocator_name = tensor.GetTensorMemoryInfo().GetAllocatorName();
ov_tensor_data_t ov_tensor_key;
ort_tensor_key_t ort_tensor_key{tensor.GetTensorRawData(), allocator_name};
{
if (const auto& it = ort_ov_tensor_map.find(ort_tensor_key); it != ort_ov_tensor_map.end()) {
ov_tensor_key = it->second;
} else {
// Does this make sense for both types of allocators?
auto input = graph_input_info.at(input_idx);
if (allocator_name == OpenVINO_RT_NPU) {
Expand All @@ -386,7 +388,7 @@ void BasicBackend::StartAsyncInference(Ort::KernelContext& context, OVInferReque
ov_tensor_key.copy_needed = true;
ov_tensor_key.tensor_ptr = std::make_shared<ov::Tensor>(input.get_element_type(), input.get_shape());
}
ort_ov_tensor_map[ort_tensor_key] = ov_tensor_key;
ort_ov_tensor_map.emplace(ort_tensor_key, ov_tensor_key);

if (ov_tensor_key.copy_needed) {
const char* ort_tensor_data = tensor.GetTensorData<char>();
Expand Down Expand Up @@ -433,7 +435,9 @@ void BasicBackend::StartAsyncInference(Ort::KernelContext& context, OVInferReque

ov_tensor_data_t ov_tensor_data;
ort_tensor_key_t ort_tensor_key{tensor.GetTensorRawData(), allocator_name};
{
if (const auto& it = ort_ov_tensor_map.find(ort_tensor_key); it != ort_ov_tensor_map.end()) {
ov_tensor_data = it->second;
} else {
auto output = graph_output_info.at(output_idx);
if (allocator_name == OpenVINO_RT_NPU) {
ov_tensor_data.copy_needed = false;
Expand All @@ -443,7 +447,7 @@ void BasicBackend::StartAsyncInference(Ort::KernelContext& context, OVInferReque
ov_tensor_data.copy_needed = true;
ov_tensor_data.tensor_ptr = std::make_shared<ov::Tensor>(output.get_element_type(), output.get_shape());
}
ort_ov_tensor_map[ort_tensor_key] = ov_tensor_data;
ort_ov_tensor_map.emplace(ort_tensor_key, ov_tensor_data);

try {
infer_request->SetTensor(output_name, ov_tensor_data.tensor_ptr);
Expand Down

0 comments on commit 4d64dc0

Please sign in to comment.