DequantizeLinear - version 19#

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

  • Domain: ai.onnx

  • Since version: 19

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.

Inputs

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

  • x_scale (T2): Scale for input ‘x’. It can be a scalar, which means a per-tensor/layer dequantization, or a 1-D tensor for per-axis dequantization.

  • 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: Constrain ‘x_zero_point’ and ‘x’ to 8-bit integer or float, or /32-bit integer tensor. Allowed types: tensor(float8e4m3fn), tensor(float8e4m3fnuz), tensor(float8e5m2), tensor(float8e5m2fnuz), tensor(int32), tensor(int8), tensor(uint8).

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

Differences with previous version (13)#

SchemaDiff: DequantizeLinear (domain 'ai.onnx')

  • old version: 13

  • new version: 19

  • breaking: yes

Breaking reasons:

  • input ‘x’ (changed): type_str changed ‘T’ -> ‘T1’

  • input ‘x_scale’ (changed): type_str changed ‘tensor(float)’ -> ‘T2’

  • input ‘x_zero_point’ (changed): type_str changed ‘T’ -> ‘T1’

  • output ‘y’ (changed): type_str changed ‘tensor(float)’ -> ‘T2’

  • type constraint ‘T’ (removed): entire constraint removed

Inputs:

  • [BREAKING] changed ‘x’: type_str changed ‘T’ -> ‘T1’

  • [BREAKING] changed ‘x_scale’: type_str changed ‘tensor(float)’ -> ‘T2’

  • [BREAKING] changed ‘x_zero_point’: type_str changed ‘T’ -> ‘T1’

Outputs:

  • [BREAKING] changed ‘y’: type_str changed ‘tensor(float)’ -> ‘T2’

Type constraints:

  • [BREAKING] removed ‘T’: entire constraint removed

  • added ‘T1’: added types: [‘tensor(float8e4m3fn)’, ‘tensor(float8e4m3fnuz)’, ‘tensor(float8e5m2)’, ‘tensor(float8e5m2fnuz)’, ‘tensor(int32)’, ‘tensor(int8)’, ‘tensor(uint8)’]

  • added ‘T2’: added types: [‘tensor(bfloat16)’, ‘tensor(float)’, ‘tensor(float16)’]

Documentation:

  • line similarity: 0.86 (+2/-0 lines)

--- DequantizeLinear v13
+++ DequantizeLinear v19
@@ -4,3 +4,5 @@
 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.