:nosearch: .. _op_ai_onnx_DequantizeLinear-23: DequantizeLinear - version 23 ============================= This page documents version **23** of operator **DequantizeLinear**. See :doc:`DequantizeLinear` for the latest version (since version 25). - **Domain**: ``ai.onnx`` - **Since version**: 23 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 and 4-bit types quantization, but the dequantization formula remains the same for consistency. The output type is determined by the attribute ``output_dtype``. If ``output_dtype`` is not supplied then the output type is the same as ``x_scale``. The output type also determines the precision of the multiplication operation. **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** (*T3*): N-D full precision output tensor. It has the same shape as input ``x``. The data type is specified by the ``output_dtype`` attribute or, in its absence, the type of ``x_scale``. **Type Constraints** - **T1**: The type of the inputs 'x_zero_point' and 'x'. Allowed types: tensor(float4e2m1), tensor(float8e4m3fn), tensor(float8e4m3fnuz), tensor(float8e5m2), tensor(float8e5m2fnuz), tensor(int16), tensor(int32), tensor(int4), tensor(int8), tensor(uint16), tensor(uint4), tensor(uint8). - **T2**: The type of the input 'x_scale'. Allowed types: tensor(bfloat16), tensor(float), tensor(float16). - **T3**: The type of the output 'y'. Allowed types: tensor(bfloat16), tensor(float), tensor(float16). Differences with previous version (21) -------------------------------------- **SchemaDiff**: ``DequantizeLinear`` (domain ``'ai.onnx'``) * old version: 21 * new version: 23 * breaking: **yes** **Breaking reasons:** * output 'y' (changed): type_str changed 'T2' -> 'T3' **Outputs:** * [BREAKING] changed 'y': type_str changed 'T2' -> 'T3' **Type constraints:** * added 'T3': added types: ['tensor(bfloat16)', 'tensor(float)', 'tensor(float16)'] * changed 'T1': added types: ['tensor(float4e2m1)'] **Documentation:** * line similarity: 0.73 (+4/-2 lines) .. code-block:: diff --- DequantizeLinear v21 +++ DequantizeLinear v23 @@ -4,7 +4,9 @@ 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. +`zero-point` is usually not used in the case of float8 and 4-bit types quantization, but the dequantization formula remains the same +for consistency. The output type is determined by the attribute `output_dtype`. If `output_dtype` is not supplied then the output type +is the same as `x_scale`. The output type also determines the precision of the multiplication operation.