openvino: [Bug] Incorrect result for ArgMin ONNX operator
System information (version)
- OpenVINO => 2022.2
- Operating System / Platform => Ubuntu 20.04
- Compiler => from pip
- Problem classification => ❔
Detailed description
inference produce an incorrect result on ArgMin ONNX operator when using larger input size.
Steps to reproduce
run the code below, I have compared the result to pytorch and onnxruntime as well
import torch
import torch.nn as nn
import numpy as np
from openvino.inference_engine import IECore
import onnxruntime as ort
class DummyModel(nn.Module):
def __init__(self):
super().__init__()
def forward(self, x: torch.Tensor):
_, idx = x.min(dim=0, keepdim=True)
return idx
def get_input(size, zero):
x = torch.ones((size,), dtype=torch.int) * -1
x[:zero] = 0
return x
if __name__ == "__main__":
onnx_model_path = "issue.onnx"
model = DummyModel()
zero_len = 4
array_len = 16
x = get_input(array_len, zero_len)
y = model(x)
input_name = "input"
output_name = "output"
torch.onnx.export(model, (x,), onnx_model_path, opset_version=11, input_names=[input_name], output_names=[output_name])
## openvino
ie = IECore()
net = ie.read_network(model=onnx_model_path)
ovino_model = ie.load_network(network=net, device_name="CPU")
pred = ovino_model.infer(inputs={input_name: x.numpy()})[output_name]
## onnxruntime
session = ort.InferenceSession(onnx_model_path, providers=["CPUExecutionProvider"])
ort_pred = session.run(None, {input_name: x.numpy().astype(np.int32)})[0]
print(f"openvino: {pred.item()}\npytorch: {y.item()}\nonnxruntime: {ort_pred.item()}")
assert(y.item() == zero_len) # pytorch
assert(ort_pred.item() == zero_len) # onnxruntime
assert(pred.item() == zero_len) # openvino
With the code above it will produce different result for openvino. But if the value of array_len is set to 15, it will produce the correct result. In general if array_len is set to >15 it will produce an incorrect result.
Edit: I have tested on openvino 2022.1.0 and did not find this problem
Issue submission checklist
- I report the issue, it’s not a question
- I checked the problem with documentation, FAQ, open issues, Stack Overflow, etc and have not found solution
- There is reproducer code and related data files: images, videos, models, etc.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 32 (12 by maintainers)
We received a ticket and will work on it. Sorry for inconvenience @triwahyuu
I have escalated this issue to our developer for a further look into this
Ref : 95244
I am not able to reproduce the problem on version 22.2 and on the current master (like @Iffa-Meah). What’s more, I have the same results for provided docker configuration: