Cast
Description
Converts the input data type to the specified data type.
Input
One input:
x: tensor of type float, float16, int8, int32, int64, uint8 or bool.
Output
One output:
y: tensor of type specified by the attribute. The data type can be bool, float16, float, int8, int16 or int32.
Property
to: (mandatory) int, target data type. Value range: The value is within the specified data type range.
Constraints
For the scenario where the data type is converted from float16 to int16: If the input data contains inf, inf is converted to the maximum value of int16. If the input data contains -inf, -inf is converted to the minimum value of int16.
For the scenario where the data type is converted from int32 to int8: Only the data within the range of (-2048, 1920) is guaranteed to be accurate.
ONNX Opset Support
Opset v8/v9/v10/v11/v12/v13/v14/v15/v16/v17/v18