mirror of
https://github.com/opencv/opencv.git
synced 2026-11-29 12:57:05 -06:00
ONNX opset 21 allows INT16 and UINT16 as the quantized type of
QuantizeLinear and DequantizeLinear. The importer already maps them to
CV_16S/CV_16U, but both layers stopped at a CV_Assert that only listed the
8-bit, int32 and fp8 types, so the four conformance cases for these dtypes
were on the parser denylist.
Accept CV_16U/CV_16S in both layers and add the dispatch branches for the
fp32/fp16 scale and activation combinations, mirroring the existing
CV_8U/CV_8S ones. The shared kernels already handle the wider types via
saturate_cast. Remove the four cases from the denylist.
Verified on macOS arm64: before the change the 8 cases
(test_{de}quantizelinear_{u,}int16 x OCV/CPU, OCV/CPU_FP16) fail on the
assertion; after it the whole Test_ONNX_conformance suite passes
(3584 tests) and the quantization unit tests pass (118 tests).