Skip to content

Double QDQ pairs causes crash for QLinearAveragePool #28030

@mcollinswisc

Description

@mcollinswisc

Describe the issue

If I have a graph that has the sequence

QuantizeLinear -> DequantizeLinear -> QuantizeLinear -> DequantizeLinear -> AveragePool -> QuantizeLinear

Then I get error:

onnxruntime.capi.onnxruntime_pybind11_state.Fail: [ONNXRuntimeError] : 1 : FAIL : Node () Op (QLinearAveragePool) [TypeInferenceError] Scale and Zero-point must be a scalar

The current best hypothesis is that the DoubleQDQPairsRemover pass is inserting singleton dimensions that cause later passes to fail.

To reproduce

In an environment with:

requirements.txt

I run:

qdq_avgpool.py

It also reproduces with the latest nightly package:

requirements_nightly.txt

Urgency

This is a hard crash when optimization is enabled, that has regressed from previous versions.

It does not happen in ONNXRuntime 1.22.1 (if I also update the model construction in qdq_avgpool.py with):

model = onnx.helper.make_model(
    graph,
    ir_version=10,
    opset_imports=[onnx.helper.make_opsetid("", 20)],
)

Platform

Linux

OS Version

Ubuntu Questing

ONNX Runtime Installation

Released Package

ONNX Runtime Version or Commit ID

1.24.4

ONNX Runtime API

Python

Architecture

X64

Execution Provider

Default CPU

Execution Provider Library Version

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    quantizationissues related to quantization

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions