:nosearch: .. _op_ai_onnx_CastLike-21: CastLike - version 21 ===================== This page documents version **21** of operator **CastLike**. See :doc:`CastLike` for the latest version (since version 25). - **Domain**: ``ai.onnx`` - **Since version**: 21 The operator casts the elements of a given input tensor (the first input) to the same data type as the elements of the second input tensor. See documentation of the Cast operator for further details. **Inputs** - **input** (*T1*): Input tensor to be cast. - **target_type** (*T2*): The (first) input tensor will be cast to produce a tensor of the same type as this (second input) tensor. **Outputs** - **output** (*T2*): Output tensor produced by casting the first input tensor to have the same type as the second input tensor. **Type Constraints** - **T1**: Constrain input types. Casting from complex is not supported. Allowed types: tensor(bfloat16), tensor(bool), tensor(double), tensor(float), tensor(float16), tensor(float8e4m3fn), tensor(float8e4m3fnuz), tensor(float8e5m2), tensor(float8e5m2fnuz), tensor(int16), tensor(int32), tensor(int4), tensor(int64), tensor(int8), tensor(string), tensor(uint16), tensor(uint32), tensor(uint4), tensor(uint64), tensor(uint8). - **T2**: Constrain output types. Casting to complex is not supported. Allowed types: tensor(bfloat16), tensor(bool), tensor(double), tensor(float), tensor(float16), tensor(float8e4m3fn), tensor(float8e4m3fnuz), tensor(float8e5m2), tensor(float8e5m2fnuz), tensor(int16), tensor(int32), tensor(int4), tensor(int64), tensor(int8), tensor(string), tensor(uint16), tensor(uint32), tensor(uint4), tensor(uint64), tensor(uint8). Examples -------- **test_castlike_no_saturate_FLOAT16_to_FLOAT8E4M3FN** .. code-block:: text Node: CastLike(input, target_type) -> (output) Attributes: saturate = 0 .. code-block:: text Inputs: input: shape=(3, 5), dtype=float16 [[ 4.790e-01, 4.802e-01, 4.998e-01, 8.193e-01, 4.702e-01], [ 7.231e-01, inf, 1.192e-07, nan, inf], [ inf, -inf, -1.192e-07, 1.192e-07, -inf]] target_type: shape=(1,), dtype=float8_e4m3fn [0] Outputs: output: shape=(3, 5), dtype=float8_e4m3fn [[0.46875, 0.46875, 0.5, 0.8125, 0.46875], [0.75, nan, 0, nan, nan], [nan, nan, -0, 0, nan]] **test_castlike_no_saturate_FLOAT16_to_FLOAT8E4M3FNUZ** .. code-block:: text Node: CastLike(input, target_type) -> (output) Attributes: saturate = 0 .. code-block:: text Inputs: input: shape=(3, 5), dtype=float16 [[ 4.790e-01, 4.802e-01, 4.998e-01, 8.193e-01, 4.702e-01], [ 7.231e-01, inf, 1.192e-07, nan, inf], [ inf, -inf, -1.192e-07, 1.192e-07, -inf]] target_type: shape=(1,), dtype=float8_e4m3fnuz [0] Outputs: output: shape=(3, 5), dtype=float8_e4m3fnuz [[0.46875, 0.46875, 0.5, 0.8125, 0.46875], [0.75, nan, 0, nan, nan], [nan, nan, 0, 0, nan]] **test_castlike_no_saturate_FLOAT16_to_FLOAT8E5M2** .. code-block:: text Node: CastLike(input, target_type) -> (output) Attributes: saturate = 0 .. code-block:: text Inputs: input: shape=(3, 5), dtype=float16 [[ 4.790e-01, 4.802e-01, 4.998e-01, 8.193e-01, 4.702e-01], [ 7.231e-01, inf, 1.192e-07, nan, inf], [ inf, -inf, -1.192e-07, 1.192e-07, -inf]] target_type: shape=(1,), dtype=float8_e5m2 [0] Outputs: output: shape=(3, 5), dtype=float8_e5m2 [[0.5, 0.5, 0.5, 0.875, 0.5], [0.75, inf, 0, nan, inf], [inf, -inf, -0, 0, -inf]] **test_castlike_no_saturate_FLOAT16_to_FLOAT8E5M2FNUZ** .. code-block:: text Node: CastLike(input, target_type) -> (output) Attributes: saturate = 0 .. code-block:: text Inputs: input: shape=(3, 5), dtype=float16 [[ 4.790e-01, 4.802e-01, 4.998e-01, 8.193e-01, 4.702e-01], [ 7.231e-01, inf, 1.192e-07, nan, inf], [ inf, -inf, -1.192e-07, 1.192e-07, -inf]] target_type: shape=(1,), dtype=float8_e5m2fnuz [0] Outputs: output: shape=(3, 5), dtype=float8_e5m2fnuz [[0.5, 0.5, 0.5, 0.875, 0.5], [0.75, nan, 0, nan, nan], [nan, nan, 0, 0, nan]] **test_castlike_no_saturate_FLOAT_to_FLOAT8E4M3FN** .. code-block:: text Node: CastLike(input, target_type) -> (output) Attributes: saturate = 0 .. code-block:: text Inputs: input: shape=(3, 5), dtype=float32 [[ 4.7892547e-01, 4.8033667e-01, 4.9968487e-01, 8.1910545e-01, 4.7031248e-01], [ 7.2290379e-01, 1.0000000e+06, 1.0000000e-07, nan, inf], [ inf, -inf, -1.0000000e-07, 1.0000000e-07, -1.0000000e+06]] target_type: shape=(1,), dtype=float8_e4m3fn [0] Outputs: output: shape=(3, 5), dtype=float8_e4m3fn [[0.46875, 0.46875, 0.5, 0.8125, 0.46875], [0.75, nan, 0, nan, nan], [nan, nan, -0, 0, nan]] **test_castlike_no_saturate_FLOAT_to_FLOAT8E4M3FNUZ** .. code-block:: text Node: CastLike(input, target_type) -> (output) Attributes: saturate = 0 .. code-block:: text Inputs: input: shape=(3, 5), dtype=float32 [[ 4.7892547e-01, 4.8033667e-01, 4.9968487e-01, 8.1910545e-01, 4.7031248e-01], [ 7.2290379e-01, 1.0000000e+06, 1.0000000e-07, nan, inf], [ inf, -inf, -1.0000000e-07, 1.0000000e-07, -1.0000000e+06]] target_type: shape=(1,), dtype=float8_e4m3fnuz [0] Outputs: output: shape=(3, 5), dtype=float8_e4m3fnuz [[0.46875, 0.46875, 0.5, 0.8125, 0.46875], [0.75, nan, 0, nan, nan], [nan, nan, 0, 0, nan]] **test_castlike_no_saturate_FLOAT_to_FLOAT8E5M2** .. code-block:: text Node: CastLike(input, target_type) -> (output) Attributes: saturate = 0 .. code-block:: text Inputs: input: shape=(3, 5), dtype=float32 [[ 4.7892547e-01, 4.8033667e-01, 4.9968487e-01, 8.1910545e-01, 4.7031248e-01], [ 7.2290379e-01, 1.0000000e+06, 1.0000000e-07, nan, inf], [ inf, -inf, -1.0000000e-07, 1.0000000e-07, -1.0000000e+06]] target_type: shape=(1,), dtype=float8_e5m2 [0] Outputs: output: shape=(3, 5), dtype=float8_e5m2 [[0.5, 0.5, 0.5, 0.875, 0.5], [0.75, inf, 0, nan, inf], [inf, -inf, -0, 0, -inf]] **test_castlike_no_saturate_FLOAT_to_FLOAT8E5M2FNUZ** .. code-block:: text Node: CastLike(input, target_type) -> (output) Attributes: saturate = 0 .. code-block:: text Inputs: input: shape=(3, 5), dtype=float32 [[ 4.7892547e-01, 4.8033667e-01, 4.9968487e-01, 8.1910545e-01, 4.7031248e-01], [ 7.2290379e-01, 1.0000000e+06, 1.0000000e-07, nan, inf], [ inf, -inf, -1.0000000e-07, 1.0000000e-07, -1.0000000e+06]] target_type: shape=(1,), dtype=float8_e5m2fnuz [0] Outputs: output: shape=(3, 5), dtype=float8_e5m2fnuz [[0.5, 0.5, 0.5, 0.875, 0.5], [0.75, nan, 0, nan, nan], [nan, nan, 0, 0, nan]] **test_cc_castlike_FLOAT16_to_FLOAT8E4M3FN** .. code-block:: text Node: CastLike(input, target_type) -> (output) .. code-block:: text Inputs: input: shape=(3, 5), dtype=float16 [[ 4.790e-01, 4.802e-01, 4.998e-01, 8.193e-01, 4.702e-01], [ 7.231e-01, inf, 1.192e-07, nan, inf], [ inf, -inf, -1.192e-07, 1.192e-07, -inf]] target_type: shape=(1,), dtype=float8_e4m3fn [0] Outputs: output: shape=(3, 5), dtype=float8_e4m3fn [[0.46875, 0.46875, 0.5, 0.8125, 0.46875], [0.75, 448, 0, nan, 448], [448, -448, -0, 0, -448]] **test_cc_castlike_FLOAT16_to_FLOAT8E4M3FNUZ** .. code-block:: text Node: CastLike(input, target_type) -> (output) .. code-block:: text Inputs: input: shape=(3, 5), dtype=float16 [[ 4.790e-01, 4.802e-01, 4.998e-01, 8.193e-01, 4.702e-01], [ 7.231e-01, inf, 1.192e-07, nan, inf], [ inf, -inf, -1.192e-07, 1.192e-07, -inf]] target_type: shape=(1,), dtype=float8_e4m3fnuz [0] Outputs: output: shape=(3, 5), dtype=float8_e4m3fnuz [[0.46875, 0.46875, 0.5, 0.8125, 0.46875], [0.75, 240, 0, nan, 240], [240, -240, 0, 0, -240]] **test_cc_castlike_FLOAT16_to_FLOAT8E5M2** .. code-block:: text Node: CastLike(input, target_type) -> (output) .. code-block:: text Inputs: input: shape=(3, 5), dtype=float16 [[ 4.790e-01, 4.802e-01, 4.998e-01, 8.193e-01, 4.702e-01], [ 7.231e-01, inf, 1.192e-07, nan, inf], [ inf, -inf, -1.192e-07, 1.192e-07, -inf]] target_type: shape=(1,), dtype=float8_e5m2 [0] Outputs: output: shape=(3, 5), dtype=float8_e5m2 [[0.5, 0.5, 0.5, 0.875, 0.5], [0.75, 57344, 0, nan, 57344], [57344, -57344, -0, 0, -57344]] **test_cc_castlike_FLOAT16_to_FLOAT8E5M2FNUZ** .. code-block:: text Node: CastLike(input, target_type) -> (output) .. code-block:: text Inputs: input: shape=(3, 5), dtype=float16 [[ 4.790e-01, 4.802e-01, 4.998e-01, 8.193e-01, 4.702e-01], [ 7.231e-01, inf, 1.192e-07, nan, inf], [ inf, -inf, -1.192e-07, 1.192e-07, -inf]] target_type: shape=(1,), dtype=float8_e5m2fnuz [0] Outputs: output: shape=(3, 5), dtype=float8_e5m2fnuz [[0.5, 0.5, 0.5, 0.875, 0.5], [0.75, 57344, 0, nan, 57344], [57344, -57344, 0, 0, -57344]] **test_cc_castlike_FLOAT16_to_FLOAT8E8M0** .. code-block:: text Node: CastLike(input, target_type) -> (output) .. code-block:: text Inputs: input: shape=(2, 4), dtype=float16 [[0. , 0.124, 0.25 , 0.5 ], [1.1 , 2. , 4. , 8. ]] target_type: shape=(1,), dtype=float8_e8m0fnu [5.87747e-39] Outputs: output: shape=(2, 4), dtype=float8_e8m0fnu [[5.87747e-39, 0.125, 0.25, 0.5], [2, 2, 4, 8]] **test_cc_castlike_FLOAT16_to_INT4** .. code-block:: text Node: CastLike(input, target_type) -> (output) .. code-block:: text Inputs: input: shape=(5, 5), dtype=float16 [[-9., -8., -7., -6., -5.], [-4., -3., -2., -1., 0.], [ 1., 2., 3., 4., 5.], [ 6., 7., 8., 9., 10.], [11., 12., 13., 14., 15.]] target_type: shape=(1,), dtype=int4 [0] Outputs: output: shape=(5, 5), dtype=int4 [[7, -8, -7, -6, -5], [-4, -3, -2, -1, 0], [1, 2, 3, 4, 5], [6, 7, -8, -7, -6], [-5, -4, -3, -2, -1]] **test_cc_castlike_FLOAT16_to_UINT4** .. code-block:: text Node: CastLike(input, target_type) -> (output) .. code-block:: text Inputs: input: shape=(5, 5), dtype=float16 [[-9., -8., -7., -6., -5.], [-4., -3., -2., -1., 0.], [ 1., 2., 3., 4., 5.], [ 6., 7., 8., 9., 10.], [11., 12., 13., 14., 15.]] target_type: shape=(1,), dtype=uint4 [0] Outputs: output: shape=(5, 5), dtype=uint4 [[7, 8, 9, 10, 11], [12, 13, 14, 15, 0], [1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15]] **test_cc_castlike_FLOAT8E4M3FNUZ_to_FLOAT** .. code-block:: text Node: CastLike(input, target_type) -> (output) .. code-block:: text Inputs: input: shape=(3, 5), dtype=float8_e4m3fnuz [[0.46875, 0.46875, 0.5, 0.8125, 0.46875], [0.75, 240, 0, nan, 240], [240, -240, 0, 0, -240]] target_type: shape=(1,), dtype=float32 [0.] Outputs: output: shape=(3, 5), dtype=float32 [[ 0.46875, 0.46875, 0.5 , 0.8125 , 0.46875], [ 0.75 , 240. , 0. , nan, 240. ], [ 240. , -240. , 0. , 0. , -240. ]] **test_cc_castlike_FLOAT8E4M3FNUZ_to_FLOAT16** .. code-block:: text Node: CastLike(input, target_type) -> (output) .. code-block:: text Inputs: input: shape=(3, 5), dtype=float8_e4m3fnuz [[0.46875, 0.46875, 0.5, 0.8125, 0.46875], [0.75, 240, 0, nan, 240], [240, -240, 0, 0, -240]] target_type: shape=(1,), dtype=float16 [0.] Outputs: output: shape=(3, 5), dtype=float16 [[ 0.4688, 0.4688, 0.5 , 0.8125, 0.4688], [ 0.75 , 240. , 0. , nan, 240. ], [ 240. , -240. , 0. , 0. , -240. ]] **test_cc_castlike_FLOAT8E4M3FN_to_FLOAT** .. code-block:: text Node: CastLike(input, target_type) -> (output) .. code-block:: text Inputs: input: shape=(3, 5), dtype=float8_e4m3fn [[0.46875, 0.46875, 0.5, 0.8125, 0.46875], [0.75, 448, 0, nan, 448], [448, -448, -0, 0, -448]] target_type: shape=(1,), dtype=float32 [0.] Outputs: output: shape=(3, 5), dtype=float32 [[ 0.46875, 0.46875, 0.5 , 0.8125 , 0.46875], [ 0.75 , 448. , 0. , nan, 448. ], [ 448. , -448. , -0. , 0. , -448. ]] **test_cc_castlike_FLOAT8E4M3FN_to_FLOAT16** .. code-block:: text Node: CastLike(input, target_type) -> (output) .. code-block:: text Inputs: input: shape=(3, 5), dtype=float8_e4m3fn [[0.46875, 0.46875, 0.5, 0.8125, 0.46875], [0.75, 448, 0, nan, 448], [448, -448, -0, 0, -448]] target_type: shape=(1,), dtype=float16 [0.] Outputs: output: shape=(3, 5), dtype=float16 [[ 0.4688, 0.4688, 0.5 , 0.8125, 0.4688], [ 0.75 , 448. , 0. , nan, 448. ], [ 448. , -448. , -0. , 0. , -448. ]] **test_cc_castlike_FLOAT8E5M2FNUZ_to_FLOAT** .. code-block:: text Node: CastLike(input, target_type) -> (output) .. code-block:: text Inputs: input: shape=(3, 5), dtype=float8_e5m2fnuz [[0.5, 0.5, 0.5, 0.875, 0.5], [0.75, 57344, 0, nan, 57344], [57344, -57344, 0, 0, -57344]] target_type: shape=(1,), dtype=float32 [0.] Outputs: output: shape=(3, 5), dtype=float32 [[ 5.0000e-01, 5.0000e-01, 5.0000e-01, 8.7500e-01, 5.0000e-01], [ 7.5000e-01, 5.7344e+04, 0.0000e+00, nan, 5.7344e+04], [ 5.7344e+04, -5.7344e+04, 0.0000e+00, 0.0000e+00, -5.7344e+04]] **test_cc_castlike_FLOAT8E5M2FNUZ_to_FLOAT16** .. code-block:: text Node: CastLike(input, target_type) -> (output) .. code-block:: text Inputs: input: shape=(3, 5), dtype=float8_e5m2fnuz [[0.5, 0.5, 0.5, 0.875, 0.5], [0.75, 57344, 0, nan, 57344], [57344, -57344, 0, 0, -57344]] target_type: shape=(1,), dtype=float16 [0.] Outputs: output: shape=(3, 5), dtype=float16 [[ 5.000e-01, 5.000e-01, 5.000e-01, 8.750e-01, 5.000e-01], [ 7.500e-01, 5.734e+04, 0.000e+00, nan, 5.734e+04], [ 5.734e+04, -5.734e+04, 0.000e+00, 0.000e+00, -5.734e+04]] **test_cc_castlike_FLOAT8E5M2_to_FLOAT** .. code-block:: text Node: CastLike(input, target_type) -> (output) .. code-block:: text Inputs: input: shape=(3, 5), dtype=float8_e5m2 [[0.5, 0.5, 0.5, 0.875, 0.5], [0.75, 57344, 0, nan, 57344], [57344, -57344, -0, 0, -57344]] target_type: shape=(1,), dtype=float32 [0.] Outputs: output: shape=(3, 5), dtype=float32 [[ 5.0000e-01, 5.0000e-01, 5.0000e-01, 8.7500e-01, 5.0000e-01], [ 7.5000e-01, 5.7344e+04, 0.0000e+00, nan, 5.7344e+04], [ 5.7344e+04, -5.7344e+04, -0.0000e+00, 0.0000e+00, -5.7344e+04]] **test_cc_castlike_FLOAT8E5M2_to_FLOAT16** .. code-block:: text Node: CastLike(input, target_type) -> (output) .. code-block:: text Inputs: input: shape=(3, 5), dtype=float8_e5m2 [[0.5, 0.5, 0.5, 0.875, 0.5], [0.75, 57344, 0, nan, 57344], [57344, -57344, -0, 0, -57344]] target_type: shape=(1,), dtype=float16 [0.] Outputs: output: shape=(3, 5), dtype=float16 [[ 5.000e-01, 5.000e-01, 5.000e-01, 8.750e-01, 5.000e-01], [ 7.500e-01, 5.734e+04, 0.000e+00, nan, 5.734e+04], [ 5.734e+04, -5.734e+04, -0.000e+00, 0.000e+00, -5.734e+04]] **test_cc_castlike_FLOAT8E8M0_to_FLOAT** .. code-block:: text Node: CastLike(input, target_type) -> (output) .. code-block:: text Inputs: input: shape=(2, 4), dtype=float8_e8m0fnu [[5.87747e-39, 0.125, 0.25, 0.5], [2, 2, 4, 8]] target_type: shape=(1,), dtype=float32 [0.] Outputs: output: shape=(2, 4), dtype=float32 [[0. , 0.125, 0.25 , 0.5 ], [2. , 2. , 4. , 8. ]] **test_cc_castlike_FLOAT8E8M0_to_FLOAT16** .. code-block:: text Node: CastLike(input, target_type) -> (output) .. code-block:: text Inputs: input: shape=(2, 4), dtype=float8_e8m0fnu [[5.87747e-39, 0.125, 0.25, 0.5], [2, 2, 4, 8]] target_type: shape=(1,), dtype=float16 [0.] Outputs: output: shape=(2, 4), dtype=float16 [[0. , 0.125, 0.25 , 0.5 ], [2. , 2. , 4. , 8. ]] **test_cc_castlike_FLOAT_to_FLOAT8E4M3FN** .. code-block:: text Node: CastLike(input, target_type) -> (output) .. code-block:: text Inputs: input: shape=(3, 5), dtype=float32 [[ 4.7892547e-01, 4.8033667e-01, 4.9968487e-01, 8.1910545e-01, 4.7031248e-01], [ 7.2290379e-01, 1.0000000e+06, 1.0000000e-07, nan, inf], [ inf, -inf, -1.0000000e-07, 1.0000000e-07, -1.0000000e+06]] target_type: shape=(1,), dtype=float8_e4m3fn [0] Outputs: output: shape=(3, 5), dtype=float8_e4m3fn [[0.46875, 0.46875, 0.5, 0.8125, 0.46875], [0.75, 448, 0, nan, 448], [448, -448, -0, 0, -448]] **test_cc_castlike_FLOAT_to_FLOAT8E4M3FNUZ** .. code-block:: text Node: CastLike(input, target_type) -> (output) .. code-block:: text Inputs: input: shape=(3, 5), dtype=float32 [[ 4.7892547e-01, 4.8033667e-01, 4.9968487e-01, 8.1910545e-01, 4.7031248e-01], [ 7.2290379e-01, 1.0000000e+06, 1.0000000e-07, nan, inf], [ inf, -inf, -1.0000000e-07, 1.0000000e-07, -1.0000000e+06]] target_type: shape=(1,), dtype=float8_e4m3fnuz [0] Outputs: output: shape=(3, 5), dtype=float8_e4m3fnuz [[0.46875, 0.46875, 0.5, 0.8125, 0.46875], [0.75, 240, 0, nan, 240], [240, -240, 0, 0, -240]] **test_cc_castlike_FLOAT_to_FLOAT8E5M2** .. code-block:: text Node: CastLike(input, target_type) -> (output) .. code-block:: text Inputs: input: shape=(3, 5), dtype=float32 [[ 4.7892547e-01, 4.8033667e-01, 4.9968487e-01, 8.1910545e-01, 4.7031248e-01], [ 7.2290379e-01, 1.0000000e+06, 1.0000000e-07, nan, inf], [ inf, -inf, -1.0000000e-07, 1.0000000e-07, -1.0000000e+06]] target_type: shape=(1,), dtype=float8_e5m2 [0] Outputs: output: shape=(3, 5), dtype=float8_e5m2 [[0.5, 0.5, 0.5, 0.875, 0.5], [0.75, 57344, 0, nan, 57344], [57344, -57344, -0, 0, -57344]] **test_cc_castlike_FLOAT_to_FLOAT8E5M2FNUZ** .. code-block:: text Node: CastLike(input, target_type) -> (output) .. code-block:: text Inputs: input: shape=(3, 5), dtype=float32 [[ 4.7892547e-01, 4.8033667e-01, 4.9968487e-01, 8.1910545e-01, 4.7031248e-01], [ 7.2290379e-01, 1.0000000e+06, 1.0000000e-07, nan, inf], [ inf, -inf, -1.0000000e-07, 1.0000000e-07, -1.0000000e+06]] target_type: shape=(1,), dtype=float8_e5m2fnuz [0] Outputs: output: shape=(3, 5), dtype=float8_e5m2fnuz [[0.5, 0.5, 0.5, 0.875, 0.5], [0.75, 57344, 0, nan, 57344], [57344, -57344, 0, 0, -57344]] **test_cc_castlike_FLOAT_to_FLOAT8E8M0** .. code-block:: text Node: CastLike(input, target_type) -> (output) .. code-block:: text Inputs: input: shape=(2, 4), dtype=float32 [[0. , 0.124, 0.25 , 0.5 ], [1.1 , 2. , 4. , 8. ]] target_type: shape=(1,), dtype=float8_e8m0fnu [5.87747e-39] Outputs: output: shape=(2, 4), dtype=float8_e8m0fnu [[5.87747e-39, 0.125, 0.25, 0.5], [2, 2, 4, 8]] **test_cc_castlike_FLOAT_to_INT4** .. code-block:: text Node: CastLike(input, target_type) -> (output) .. code-block:: text Inputs: input: shape=(5, 5), dtype=float32 [[-9., -8., -7., -6., -5.], [-4., -3., -2., -1., 0.], [ 1., 2., 3., 4., 5.], [ 6., 7., 8., 9., 10.], [11., 12., 13., 14., 15.]] target_type: shape=(1,), dtype=int4 [0] Outputs: output: shape=(5, 5), dtype=int4 [[7, -8, -7, -6, -5], [-4, -3, -2, -1, 0], [1, 2, 3, 4, 5], [6, 7, -8, -7, -6], [-5, -4, -3, -2, -1]] **test_cc_castlike_FLOAT_to_UINT4** .. code-block:: text Node: CastLike(input, target_type) -> (output) .. code-block:: text Inputs: input: shape=(5, 5), dtype=float32 [[-9., -8., -7., -6., -5.], [-4., -3., -2., -1., 0.], [ 1., 2., 3., 4., 5.], [ 6., 7., 8., 9., 10.], [11., 12., 13., 14., 15.]] target_type: shape=(1,), dtype=uint4 [0] Outputs: output: shape=(5, 5), dtype=uint4 [[7, 8, 9, 10, 11], [12, 13, 14, 15, 0], [1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15]] **test_cc_castlike_INT4_to_FLOAT** .. code-block:: text Node: CastLike(input, target_type) -> (output) .. code-block:: text Inputs: input: shape=(5, 5), dtype=int4 [[7, -8, -7, -6, -5], [-4, -3, -2, -1, 0], [1, 2, 3, 4, 5], [6, 7, -8, -7, -6], [-5, -4, -3, -2, -1]] target_type: shape=(1,), dtype=float32 [0.] Outputs: output: shape=(5, 5), dtype=float32 [[ 7., -8., -7., -6., -5.], [-4., -3., -2., -1., 0.], [ 1., 2., 3., 4., 5.], [ 6., 7., -8., -7., -6.], [-5., -4., -3., -2., -1.]] **test_cc_castlike_INT4_to_FLOAT16** .. code-block:: text Node: CastLike(input, target_type) -> (output) .. code-block:: text Inputs: input: shape=(5, 5), dtype=int4 [[7, -8, -7, -6, -5], [-4, -3, -2, -1, 0], [1, 2, 3, 4, 5], [6, 7, -8, -7, -6], [-5, -4, -3, -2, -1]] target_type: shape=(1,), dtype=float16 [0.] Outputs: output: shape=(5, 5), dtype=float16 [[ 7., -8., -7., -6., -5.], [-4., -3., -2., -1., 0.], [ 1., 2., 3., 4., 5.], [ 6., 7., -8., -7., -6.], [-5., -4., -3., -2., -1.]] **test_cc_castlike_INT4_to_INT8** .. code-block:: text Node: CastLike(input, target_type) -> (output) .. code-block:: text Inputs: input: shape=(5, 5), dtype=int4 [[7, -8, -7, -6, -5], [-4, -3, -2, -1, 0], [1, 2, 3, 4, 5], [6, 7, -8, -7, -6], [-5, -4, -3, -2, -1]] target_type: shape=(1,), dtype=int8 [0] Outputs: output: shape=(5, 5), dtype=int8 [[ 7, -8, -7, -6, -5], [-4, -3, -2, -1, 0], [ 1, 2, 3, 4, 5], [ 6, 7, -8, -7, -6], [-5, -4, -3, -2, -1]] **test_cc_castlike_UINT4_to_FLOAT** .. code-block:: text Node: CastLike(input, target_type) -> (output) .. code-block:: text Inputs: input: shape=(5, 5), dtype=uint4 [[7, 8, 9, 10, 11], [12, 13, 14, 15, 0], [1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15]] target_type: shape=(1,), dtype=float32 [0.] Outputs: output: shape=(5, 5), dtype=float32 [[ 7., 8., 9., 10., 11.], [12., 13., 14., 15., 0.], [ 1., 2., 3., 4., 5.], [ 6., 7., 8., 9., 10.], [11., 12., 13., 14., 15.]] **test_cc_castlike_UINT4_to_FLOAT16** .. code-block:: text Node: CastLike(input, target_type) -> (output) .. code-block:: text Inputs: input: shape=(5, 5), dtype=uint4 [[7, 8, 9, 10, 11], [12, 13, 14, 15, 0], [1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15]] target_type: shape=(1,), dtype=float16 [0.] Outputs: output: shape=(5, 5), dtype=float16 [[ 7., 8., 9., 10., 11.], [12., 13., 14., 15., 0.], [ 1., 2., 3., 4., 5.], [ 6., 7., 8., 9., 10.], [11., 12., 13., 14., 15.]] **test_cc_castlike_UINT4_to_UINT8** .. code-block:: text Node: CastLike(input, target_type) -> (output) .. code-block:: text Inputs: input: shape=(5, 5), dtype=uint4 [[7, 8, 9, 10, 11], [12, 13, 14, 15, 0], [1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15]] target_type: shape=(1,), dtype=uint8 [0] Outputs: output: shape=(5, 5), dtype=uint8 [[ 7, 8, 9, 10, 11], [12, 13, 14, 15, 0], [ 1, 2, 3, 4, 5], [ 6, 7, 8, 9, 10], [11, 12, 13, 14, 15]] Differences with previous version (19) -------------------------------------- **SchemaDiff**: ``CastLike`` (domain ``'ai.onnx'``) * old version: 19 * new version: 21 * breaking: no **Type constraints:** * changed 'T1': added types: ['tensor(int4)', 'tensor(uint4)'] * changed 'T2': added types: ['tensor(int4)', 'tensor(uint4)']