TECHNOLOGY

ONNX Runtime CPU QuantizeLinear: read the scale using its own type before choosing division precision

In this article
THE QUICK TAKE

The 1.32 CPU QuantizeLinear update separates tensor storage types from division precision; rounding-sensitive mixed-type inputs are essential tests.

ONNX Runtime 1.32.0 supports independent input and scale types and the opset-23 precision attribute in CPU QuantizeLinear. The linked PR distinguishes reading each tensor correctly from choosing arithmetic precision. Rounding a wider scale down to the input type first can change the final integer code even when the input value itself is unchanged.

The scale is not an input-typed byte array

The input and scale have independent declared element types. Reading scale storage as though it used the input type is therefore not a valid shortcut. A proposed test uses a scale whose wider representation differs meaningfully from its narrowed form. Keep its raw encoding and the input fixed, then compare against an explicit reference that reads each with the correct type before doing arithmetic.

Arithmetic precision is another decision

After storage is interpreted correctly, the operator still has a precision rule for division. The PR handles explicit precision and a default based on the scale type for the relevant opset path. Test default and explicit modes separately. A tolerance on dequantized output can hide a one-code boundary difference, so compare the quantized codes directly where exact output is specified. Preserve the model’s declared opset with the result.

Granularity and packed tails add indexing coverage

The linked regressions cover granularities and packed outputs as well as the scalar precision example. A local suite should include per-axis or blocked parameters used by the application and an odd tail where supported. Correct scalar rounding does not establish the right scale was selected for every element. Use different scales across parameter groups so a wrong index cannot be hidden by identical values.

CPU quantization is the stated scope

The PR explicitly separates CPU quantization from dequantization and CUDA work. Do not infer identical coverage for those routes from this release entry. This article reports the type-and-precision correction and proposed tests without independent numerical measurements. A useful compatibility result names provider, opset, input type, scale type and precision mode, connecting the accepted model contract to the actual code path exercised.

Sources

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