(l-onnx-doc-CastLike)= # CastLike (l-onnx-op-castlike-23)= ## CastLike - 23 ### Version - **name**: [CastLike (GitHub)](https://github.com/onnx/onnx/blob/main/docs/Operators.md#CastLike) - **domain**: `main` - **since_version**: `23` - **function**: `True` - **support_level**: `SupportType.COMMON` - **shape inference**: `True` This version of the operator has been available **since version 23**. ### Summary 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. ### Attributes * **saturate - INT** (default is `'1'`): The parameter defines how the conversion behaves if an input value is out of range of the destination type. It only applies for float 8 conversion (float8e4m3fn, float8e4m3fnuz, float8e5m2, float8e5m2fnuz). It is true by default. Please refer to operator Cast description for further details. ### Inputs - **input** (heterogeneous) - **T1**: Input tensor to be cast. - **target_type** (heterogeneous) - **T2**: The (first) input tensor will be cast to produce a tensor of the same type as this (second input) tensor. ### Outputs - **output** (heterogeneous) - **T2**: Output tensor produced by casting the first input tensor to have the same type as the second input tensor. ### Type Constraints * **T1** in ( `tensor(bfloat16)`, `tensor(bool)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(float4e2m1)`, `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)` ): Constrain input types. Casting from complex is not supported. * **T2** in ( `tensor(bfloat16)`, `tensor(bool)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(float4e2m1)`, `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)` ): Constrain output types. Casting to complex is not supported. ```{toctree} text_diff_CastLike_21_23 ``` (l-onnx-op-castlike-21)= ## CastLike - 21 ### Version - **name**: [CastLike (GitHub)](https://github.com/onnx/onnx/blob/main/docs/Operators.md#CastLike) - **domain**: `main` - **since_version**: `21` - **function**: `True` - **support_level**: `SupportType.COMMON` - **shape inference**: `True` This version of the operator has been available **since version 21**. ### Summary 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. ### Attributes * **saturate - INT** (default is `'1'`): The parameter defines how the conversion behaves if an input value is out of range of the destination type. It only applies for float 8 conversion (float8e4m3fn, float8e4m3fnuz, float8e5m2, float8e5m2fnuz). It is true by default. Please refer to operator Cast description for further details. ### Inputs - **input** (heterogeneous) - **T1**: Input tensor to be cast. - **target_type** (heterogeneous) - **T2**: The (first) input tensor will be cast to produce a tensor of the same type as this (second input) tensor. ### Outputs - **output** (heterogeneous) - **T2**: Output tensor produced by casting the first input tensor to have the same type as the second input tensor. ### Type Constraints * **T1** in ( `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)` ): Constrain input types. Casting from complex is not supported. * **T2** in ( `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)` ): Constrain output types. Casting to complex is not supported. ```{toctree} text_diff_CastLike_19_23 text_diff_CastLike_19_21 ``` (l-onnx-op-castlike-19)= ## CastLike - 19 ### Version - **name**: [CastLike (GitHub)](https://github.com/onnx/onnx/blob/main/docs/Operators.md#CastLike) - **domain**: `main` - **since_version**: `19` - **function**: `True` - **support_level**: `SupportType.COMMON` - **shape inference**: `True` This version of the operator has been available **since version 19**. ### Summary 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. ### Attributes * **saturate - INT** (default is `'1'`): The parameter defines how the conversion behaves if an input value is out of range of the destination type. It only applies for float 8 conversion (float8e4m3fn, float8e4m3fnuz, float8e5m2, float8e5m2fnuz). It is true by default. Please refer to operator Cast description for further details. ### Inputs - **input** (heterogeneous) - **T1**: Input tensor to be cast. - **target_type** (heterogeneous) - **T2**: The (first) input tensor will be cast to produce a tensor of the same type as this (second input) tensor. ### Outputs - **output** (heterogeneous) - **T2**: Output tensor produced by casting the first input tensor to have the same type as the second input tensor. ### Type Constraints * **T1** in ( `tensor(bfloat16)`, `tensor(bool)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(float8e4m3fn)`, `tensor(float8e4m3fnuz)`, `tensor(float8e5m2)`, `tensor(float8e5m2fnuz)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(string)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` ): Constrain input types. Casting from complex is not supported. * **T2** in ( `tensor(bfloat16)`, `tensor(bool)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(float8e4m3fn)`, `tensor(float8e4m3fnuz)`, `tensor(float8e5m2)`, `tensor(float8e5m2fnuz)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(string)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` ): Constrain output types. Casting to complex is not supported. ```{toctree} text_diff_CastLike_15_23 text_diff_CastLike_15_21 text_diff_CastLike_15_19 ``` (l-onnx-op-castlike-15)= ## CastLike - 15 ### Version - **name**: [CastLike (GitHub)](https://github.com/onnx/onnx/blob/main/docs/Operators.md#CastLike) - **domain**: `main` - **since_version**: `15` - **function**: `True` - **support_level**: `SupportType.COMMON` - **shape inference**: `True` This version of the operator has been available **since version 15**. ### Summary 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** (heterogeneous) - **T1**: Input tensor to be cast. - **target_type** (heterogeneous) - **T2**: The (first) input tensor will be cast to produce a tensor of the same type as this (second input) tensor. ### Outputs - **output** (heterogeneous) - **T2**: Output tensor produced by casting the first input tensor to have the same type as the second input tensor. ### Type Constraints * **T1** in ( `tensor(bfloat16)`, `tensor(bool)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(string)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` ): Constrain input types. Casting from complex is not supported. * **T2** in ( `tensor(bfloat16)`, `tensor(bool)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(string)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` ): Constrain output types. Casting to complex is not supported.