openvino
4832243b - Fix DequantizeLinear-21 blocked quantization for axis > 1 (#32918)

Commit
124 days ago
Fix DequantizeLinear-21 blocked quantization for axis > 1 (#32918) ### Details: This PR fixes incorrect behavior of DequantizeLinear operator (opset 21) with blocked quantization when axis > 1. The old implementation had two issues: 1. Did not support axis > 1 (returned error "Axis > 1 isn't supported") 2. For axis = 1, produced incorrect results due to wrong dimension ordering The root cause was incorrect reshape logic that used different ordering for axis = 0 vs axis > 0: - axis = 0: [num_blocks, block_size, ...] - correct - axis > 0: [D0, ..., block_size, num_blocks, ...] - incorrect This caused elements to interleave instead of forming sequential blocks, which violates the ONNX specification. ### Example For axis=1, block_size=2, input=[9,9,9,9,9,9,9,9], scale=[1,2,3,4], zero_point=[1,2,3,4]: - Old output (incorrect): [8, 14, 8, 14, 18, 20, 18, 20] - elements interleaved - New output (correct): [8, 8, 14, 14, 18, 18, 20, 20] - sequential blocks - ONNX Runtime: [8, 8, 14, 14, 18, 18, 20, 20] - matches new implementation ### Changes 1. Removed axis <= 1 restriction 2. Fixed reshape to always use [D0, ..., num_blocks, block_size, ...] ordering for all axes 3. Fixed unsqueeze position: changed from conditional (axis == 0 ? 1 : axis) to always axis + 1 ### Implementation src/frontends/onnx/frontend/src/op/dequantize_linear.cpp: - Unified reshape logic: always split dimension at axis into [num_blocks, block_size] - Fixed unsqueeze_axis = axis + 1 (previously was incorrect for axis > 0) - Removed axis validation that limited support to axis <= 1 Updated 1 existing test: - onnx_model_dequantize_linear_opset21_4d: fixed expected output (was using old incorrect interleaved values) ### Tickets: - 164793
Author
Parents
Loading