.. _op_ai_onnx_DequantizePacked: DequantizePacked ================ - **Domain**: ``ai.onnx`` - **Since version**: 29 Dequantizes the packed payload of one quantized tensor. ``x`` is a one-dimensional UINT8 tensor containing exactly the tensor's bytes. All multibyte fields are little-endian. ``format`` selects an ONNX-defined, case-sensitive fixed identifier, without parameters: gguf:q4_0, gguf:q4_1, gguf:q5_0, gguf:q5_1, gguf:q8_0, gguf:q8_1, gguf:q2_k, gguf:q3_k, gguf:q4_k, gguf:q5_k, gguf:q6_k, gguf:q8_k, gguf:iq2_xxs, gguf:iq2_xs, gguf:iq3_xxs, gguf:iq1_s, gguf:iq4_nl, gguf:iq3_s, gguf:iq2_s, gguf:iq4_xs, gguf:iq1_m, gguf:tq1_0, gguf:tq2_0, gguf:mxfp4, gguf:nvfp4, gguf:q1_0, gguf:q2_0. Byte layouts, decoding arithmetic and complete IQ codebooks are defined in the `DequantizePacked decoding specification `_. ``shape`` gives static dimensions in ONNX row-major order. Rank must be at least one, dimensions must be nonnegative, and the last dimension must be block-aligned, even for an empty tensor. For B elements and S bytes per block, input length is ``product(shape[:-1]) * (shape[-1] / B) * S``. Blocks are decoded in input order using FLOAT arithmetic, reshaped to ``shape``, then converted once to ``output_dtype`` (FLOAT by default, FLOAT16, BFLOAT16 or DOUBLE). FLOAT16 and BFLOAT16 conversion uses round-to-nearest, ties-to-even, as in Cast. **Inputs** - **x** (*tensor(uint8)*): Consecutive quantization blocks with little-endian fields. **Outputs** - **y** (*T*): Dequantized tensor with the specified shape and output_dtype. **Attributes** - **format** (*string*): ONNX-defined, case-sensitive fixed quantization format identifier. - **output_dtype** (*int*): ONNX TensorProto data type of the output: FLOAT, FLOAT16, BFLOAT16, or DOUBLE. - **shape** (*int[]*): Logical output dimensions in ONNX order; rank at least one. **Type Constraints** - **T**: Floating-point output. Allowed types: tensor(bfloat16), tensor(double), tensor(float), tensor(float16). Examples -------- **test_dequantizepacked_empty** .. code-block:: text Node: DequantizePacked(x) -> (y) Attributes: format = "gguf:q2_k" shape = [0, 256] .. code-block:: text Inputs: x: shape=(0,), dtype=uint8 [] Outputs: y: shape=(0, 256), dtype=float32 [] **test_dequantizepacked_iq4_nl_float16** .. code-block:: text Node: DequantizePacked(x) -> (y) Attributes: format = "gguf:iq4_nl" shape = [32] output_dtype = 10 .. code-block:: text Inputs: x: shape=(18,), dtype=uint8 [ 0, 56, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15] Outputs: y: shape=(32,), dtype=float16 [-63.5, -52. , -41.5, -32.5, -24.5, -17.5, -11. , -5. , 0.5, 6.5, 12.5, 19. , 26.5, 34.5, 44.5, 56.5, -63.5, -63.5, -63.5, -63.5, -63.5, -63.5, -63.5, -63.5, -63.5, -63.5, -63.5, -63.5, -63.5, -63.5, -63.5, -63.5] **test_dequantizepacked_mxfp4** .. code-block:: text Node: DequantizePacked(x) -> (y) Attributes: format = "gguf:mxfp4" shape = [32] .. code-block:: text Inputs: x: shape=(17,), dtype=uint8 [127, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15] Outputs: y: shape=(32,), dtype=float32 [ 0. , 0.5, 1. , 1.5, 2. , 3. , 4. , 6. , 0. , -0.5, -1. , -1.5, -2. , -3. , -4. , -6. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. ] **test_dequantizepacked_q4_0** .. code-block:: text Node: DequantizePacked(x) -> (y) Attributes: format = "gguf:q4_0" shape = [2, 32] .. code-block:: text Inputs: x: shape=(36,), dtype=uint8 [ 0, 56, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0, 192, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240] Outputs: y: shape=(2, 32), dtype=float32 [[ -4. , -3.5, -3. , -2.5, -2. , -1.5, -1. , -0.5, 0. , 0.5, 1. , 1.5, 2. , 2.5, 3. , 3.5, -4. , -4. , -4. , -4. , -4. , -4. , -4. , -4. , -4. , -4. , -4. , -4. , -4. , -4. , -4. , -4. ], [ 16. , 16. , 16. , 16. , 16. , 16. , 16. , 16. , 16. , 16. , 16. , 16. , 16. , 16. , 16. , 16. , -14. , -14. , -14. , -14. , -14. , -14. , -14. , -14. , -14. , -14. , -14. , -14. , -14. , -14. , -14. , -14. ]] **test_dequantizepacked_q5_1** .. code-block:: text Node: DequantizePacked(x) -> (y) Attributes: format = "gguf:q5_1" shape = [32] .. code-block:: text Inputs: x: shape=(24,), dtype=uint8 [ 0, 56, 0, 188, 0, 0, 255, 255, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15] Outputs: y: shape=(32,), dtype=float32 [-1. , -0.5, 0. , 0.5, 1. , 1.5, 2. , 2.5, 3. , 3.5, 4. , 4.5, 5. , 5.5, 6. , 6.5, 7. , 7. , 7. , 7. , 7. , 7. , 7. , 7. , 7. , 7. , 7. , 7. , 7. , 7. , 7. , 7. ]