DequantizeLinear - version 21#

This page documents version 21 of operator DequantizeLinear. See DequantizeLinear for the latest version (since version 25).

  • Domain: ai.onnx

  • Since version: 21

The linear dequantization operator. It consumes a quantized tensor, a scale, and a zero point to compute the full-precision tensor. The dequantization formula is y = (x - x_zero_point) * x_scale. x_scale and x_zero_point must have the same shape, determining the quantization’s granularity: a scalar for per-tensor/per-layer quantization, a 1-D tensor for per-axis quantization, or have a rank identical to the input for blocked quantization. See QuantizeLinear for details on quantization granularity. x_zero_point and x must have the same type. x and y must have the same shape. In the case of dequantizing int32, there’s no zero point (zero point is supposed to be 0). zero-point is usually not used in the case of float8 types quantization, but the dequantization formula remains the same for consistency, and x_scale still determines the output type.

Inputs

  • x (T1): N-D quantized input tensor to be de-quantized.

  • x_scale (T2): Scale for input x. For per-tensor/layer dequantization the scale is a scalar, for per per-axis dequantization it is a 1-D Tensor and for blocked dequantization it has the same shape as the input, except for one dimension in which blocking is performed.

  • x_zero_point (T1): Zero point for input x. Shape must match x_scale. It’s optional. Zero point is 0 when it’s not specified.

Outputs

  • y (T2): N-D full precision output tensor. It has same shape as input x.

Type Constraints

  • T1: The type of the inputs ‘x_zero_point’ and ‘x’. Allowed types: tensor(float8e4m3fn), tensor(float8e4m3fnuz), tensor(float8e5m2), tensor(float8e5m2fnuz), tensor(int16), tensor(int32), tensor(int4), tensor(int8), tensor(uint16), tensor(uint4), tensor(uint8).

  • T2: ‘x_scale’ determines the output type. Allowed types: tensor(bfloat16), tensor(float), tensor(float16).

Differences with previous version (19)#

SchemaDiff: DequantizeLinear (domain 'ai.onnx')

  • old version: 19

  • new version: 21

  • breaking: no

Type constraints:

  • changed ‘T1’: added types: [‘tensor(int16)’, ‘tensor(int4)’, ‘tensor(uint16)’, ‘tensor(uint4)’]

Documentation:

  • line similarity: 0.11 (+9/-7 lines)

--- DequantizeLinear v19
+++ DequantizeLinear v21
@@ -1,8 +1,10 @@

-The linear dequantization operator. It consumes a quantized tensor, a scale, and a zero point to compute the full precision tensor.
-The dequantization formula is `y = (x - x_zero_point) * x_scale`. `x_scale` and `x_zero_point` must have same shape, and can be either a scalar
-for per-tensor / per layer quantization, or a 1-D tensor for per-axis quantization.
-`x_zero_point` and `x` must have same type. `x` and `y` must have same shape. In the case of dequantizing int32,
-there's no zero point (zero point is supposed to be 0).
-`zero-point` is usually not used in the case of float8e4m3fn, float8e4m3fnuz, float8e5m2, float8e5m2fnuz quantization,
-but the dequantization formula remains the same for consistency and 'x_scale' still determines the output type.
+The linear dequantization operator. It consumes a quantized tensor, a scale, and a zero point to compute the
+full-precision tensor. The dequantization formula is `y = (x - x_zero_point) * x_scale`. `x_scale` and `x_zero_point`
+must have the same shape, determining the quantization's granularity: a scalar for per-tensor/per-layer quantization,
+a 1-D tensor for per-axis quantization, or have a rank identical to the input for blocked quantization.
+See QuantizeLinear for details on quantization granularity.
+`x_zero_point` and `x` must have the same type. `x` and `y` must have the same shape. In the case of dequantizing
+`int32`, there's no zero point (zero point is supposed to be 0).
+`zero-point` is usually not used in the case of float8 types quantization, but the dequantization formula remains the same
+for consistency, and `x_scale` still determines the output type.