onnxruntime
03245616 - Fix incorrect output for QDQ Resize with non-nearest interpolation modes under ORT_ENABLE_ALL (#28454)

Commit
37 days ago
Fix incorrect output for QDQ Resize with non-nearest interpolation modes under ORT_ENABLE_ALL (#28454) ### Description - **`qdq_selectors.cc`**: In `DropQDQNodeGroupSelector::Check`, add a guard that skips the QDQ-drop optimization when the target node is `Resize` with a non-nearest `mode` attribute (`"linear"`, `"cubic"`, etc.). When `mode` is absent the ONNX default is `"nearest"`, so the optimization remains allowed in that case. - **`qdq_transformer_test.cc`**: Add `Resize_Linear_No_QDQ_Drop` test asserting that DQ/Q nodes are preserved around `Resize` for `linear` and `cubic` modes after Level2 optimization. ### Motivation and Context The `DropQDQ` optimizer incorrectly dropped the surrounding DQ/Q nodes for **all** `Resize` modes. Dropping these nodes bypasses float-space interpolation — `Resize` ends up operating directly on raw quantized integers, producing wrong results. The optimization is only semantically valid for `mode="nearest"`, which copies existing quantized values without arithmetic. For interpolating modes, the full `DQ → Resize → Q` chain must execute in float space: ``` # With ORT_DISABLE_ALL (correct): DQ → float → Resize(linear) → Q ✓ # With ORT_ENABLE_ALL (before fix): Resize(linear) on raw int8 ✗ ``` Input `[2.0, 7.0, 4.0]` upsampled 1×1×1×3 → 1×1×1×6 with `half_pixel`: - Expected / DISABLE_ALL: `[2.0, 3.0, 6.0, 6.0, 5.0, 4.0]` - ENABLE_ALL before fix: `[2.0, 3.0, 5.0, 6.0, 4.0, 4.0]` --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: tianleiwu <30328909+tianleiwu@users.noreply.github.com> Co-authored-by: Tianlei Wu <tlwu@microsoft.com>
Author
Parents
Loading