microsoft / microsoft/onnxruntime

[BUG] QLinearConv uses same value for all zero_points!

Open
#8,890 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature request quantization
Dominant language
C++
Stars
21.9k
Forks
4.2k
Avg merge
4d 8h
Merged PRs (30d)
179

Description

https://github.com/microsoft/onnxruntime/blob/36fa0de8b729624d09094b22302781cd0e3ebc78/onnxruntime/core/providers/cpu/nn/qlinearconv.cc#L247

Zero-points as 1D tensor have different values for each element when quantized per output channel.
When W is quantized asymmetric, this is of course the case.

ORT quantization tool can generate ONNX files with asymmetric weights but runtime crashes here and shows this error.

Thanks for fixing this bug, I really need this fix to run models that otherwise have very bad accuracy.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at onnxruntime/core/providers/cpu/nn/qlinearconv.cc around line 247 and inspect how zero-points are read for per-output-channel weights. Reproduce the failure with an ONNX model generated by the ORT quantization tool using asymmetric weights, then verify that distinct zero-point values are handled without a runtime crash and preserve model execution.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, machine-learning
Domain
backend, machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.