TECHNOLOGY

ONNX QuantizeLinear: the scale shape and axis define what is quantized together

In this article
THE QUICK TAKE

Integer storage does not identify the quantization contract; scale association must match tensor axes and the selected operator schema.

A transpose preserves bytes but changes channel meaning

An optimization moves a weight tensor into another axis order and carries its quantization constants along unchanged. The model still loads, yet the scale vector now applies to the wrong logical channels. This failure is not explained by saying that quantization reduces precision. It is a mismatch between tensor indexing and parameter association. Review the transformed axis relationship before adjusting tolerances or collecting a larger calibration set to compensate for an incorrectly represented computation.

Granularity comes from the scale representation

The QuantizeLinear specification describes different quantization granularities through scale shapes and associated attributes. Read the imported schema rather than assuming every form is a scalar scale or a simple channel vector. For per-axis use, the selected axis and scale extent must describe the intended tensor dimension. Record that relationship explicitly so a later layout rewrite cannot mistake a compatible integer dtype for a complete semantic contract.

Dequantization must describe the same association

The DequantizeLinear specification defines the reverse representation step. Inspect how scales and zero points are connected on both sides of a quantized region. A mismatched pairing can produce plausible but systematically distorted values. The tensor descriptor guide explains why logical axes and physical storage are separate concerns; changing either requires attention to how the quantization parameters index the intended values.

Schema versions constrain the valid forms

The ONNX versioning policy explains why operator meaning belongs to an imported version. Newer granularity or type support cannot be assumed available in an older export or consumer. Check the concrete graph and execution provider support together. Then compare representative channels, saturation-sensitive inputs and values around representable transitions. Separate an axis-association defect from expected rounding error; they require different remedies and should not share an unexplained tolerance increase.

Validate the transformed mathematical contract

Retain a small reference case with deliberately different scale behavior across channels. Equal scales can hide an incorrect axis mapping, so a uniform synthetic example is weak evidence. Report tensor shape, axis meaning, scale shape and operator imports with the result comparison. The mixed precision guide provides additional context for numerical evaluation, while this check establishes whether the quantized graph represents the intended channel-wise computation in the first place.

Earn rental income from GPUs

Have idle GPUs or looking to fund AI infrastructure? Retrivium finds a rental platform, sets up the server and helps you assess income and costs with a pilot.

Explore GPU hosting
← All articles