Open
Description
Describe the issue
The OV's implementation:
// levels is the number of quantization levels (e.g. 2 is for binarization, 255/256 is for int8 quantization)
if x <= min(input_low, input_high):
output = output_low
elif x > max(input_low, input_high):
output = output_high
else:
# input_low < x <= input_high
output = round((x - input_low) / (input_high - input_low) * (levels-1)) / (levels-1) * (output_high - output_low) + output_low
The ONNX's implementation:
y = round((x / y_scale) + y_zero_point)
It used helf to the nearest even. And OV used half away from zero, so it will have 1
difference in some corner case.
To reproduce
onnxruntime_test_all.exe --gtest_filter=QuantizeLinearOpTest.Int8_PositiveZeroPoint
Note: Google Test filter = QuantizeLinearOpTest.Int8_PositiveZeroPoint
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from QuantizeLinearOpTest
[ RUN ] QuantizeLinearOpTest.Int8_PositiveZeroPoint
No of unsupported nodes 0
D:\lianggao\Documents\onnxruntime\onnxruntime\test\providers\checkers.cc(314): error: Expected equality of these values:
cur_expected[i]
Which is: 'c' (99, 0x63)
cur_actual[i]
Which is: 'd' (100, 0x64)
i:2
Google Test trace:
D:\lianggao\Documents\onnxruntime\onnxruntime\test\providers\checkers.cc(568): provider type: OpenVINOExecutionProvider
D:\lianggao\Documents\onnxruntime\onnxruntime\test\providers\base_tester.cc(846): registered execution providers: OpenVINOExecutionProvider
Stack trace:
00007FF7133E28DE: (unknown)
00007FF7133E0245: (unknown)
00007FF7133E0A3A: (unknown)
00007FF7133EE7B1: (unknown)
00007FF7133D5EF2: (unknown)
00007FF7133DBB6C: (unknown)
00007FF7133DE03D: (unknown)
00007FF7133DC9FD: (unknown)
00007FF7133DCB38: (unknown)
00007FF7138FAB05: (unknown)
00007FF7143CC69B: (unknown)
00007FF7143CC586: (unknown)
00007FF7143F2034: (unknown)
00007FF7143F214D: (unknown)
00007FF7143F22EE: (unknown)
... Google Test internal frames ...
[ FAILED ] QuantizeLinearOpTest.Int8_PositiveZeroPoint (860 ms)
[----------] 1 test from QuantizeLinearOpTest (886 ms total)
[----------] Global test environment tear-down
[==========] 1 test from 1 test suite ran. (892 ms total)
[ PASSED ] 0 tests.
[ FAILED ] 1 test, listed below:
[ FAILED ] QuantizeLinearOpTest.Int8_PositiveZeroPoint
1 FAILED TEST
Urgency
No response
Platform
Windows
OS Version
Win11
ONNX Runtime Installation
Built from Source
ONNX Runtime Version or Commit ID
ONNX Runtime API
C++
Architecture
X64
Execution Provider
OpenVINO
Execution Provider Library Version
No response