Cast - version 19#
This page documents version 19 of operator Cast. See Cast for the latest version (since version 28).
Domain:
ai.onnxSince version: 19
The operator casts the elements of a given input tensor to a data type specified by the ‘to’ argument and returns an output tensor of the same size in the converted type. The ‘to’ argument must be one of the data types specified in the ‘DataType’ enum field in the TensorProto message. The onnx-light native runtime additionally supports complex64 and complex128 as an extension to ONNX Cast. Real-to-complex casts set the imaginary component to zero. Complex-to-real casts discard it; complex precision casts preserve both components. Complex casts involving strings, float8 or packed types are unsupported. The standard ONNX schemas and full checker do not accept this extension.
Inputs
input (T1): Input tensor to be cast.
Outputs
output (T2): Output tensor with the same shape as input with type specified by the ‘to’ argument
Attributes
saturate (int): 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. All cases are fully described in two tables inserted in the operator description.
to (int): The data type to which the elements of the input tensor are cast. Strictly must be one of the types from DataType enum in TensorProto.
Type Constraints
T1: Constrain input types. Complex types are an onnx-light runtime extension. Allowed types: tensor(bfloat16), tensor(bool), tensor(complex128), tensor(complex64), 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).
T2: Constrain output types. Complex types are an onnx-light runtime extension. Allowed types: tensor(bfloat16), tensor(bool), tensor(complex128), tensor(complex64), 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).
Examples#
test_cc_cast_BFLOAT16_to_BOOL
Node:
Cast(input) -> (output)
Attributes:
to = 9
Inputs:
input: shape=(4,), dtype=bfloat16
[-3, 0, 7, 42]
Outputs:
output: shape=(4,), dtype=bool
[ True, False, True, True]
test_cc_cast_BFLOAT16_to_DOUBLE
Node:
Cast(input) -> (output)
Attributes:
to = 11
Inputs:
input: shape=(4,), dtype=bfloat16
[-3, 0, 7, 42]
Outputs:
output: shape=(4,), dtype=float64
[-3., 0., 7., 42.]
test_cc_cast_BFLOAT16_to_FLOAT
Node:
Cast(input) -> (output)
Attributes:
to = 1
Inputs:
input: shape=(4,), dtype=bfloat16
[-3, 0, 7, 42]
Outputs:
output: shape=(4,), dtype=float32
[-3., 0., 7., 42.]
test_cc_cast_BFLOAT16_to_FLOAT16
Node:
Cast(input) -> (output)
Attributes:
to = 10
Inputs:
input: shape=(4,), dtype=bfloat16
[-3, 0, 7, 42]
Outputs:
output: shape=(4,), dtype=float16
[-3., 0., 7., 42.]
test_cc_cast_BFLOAT16_to_INT16
Node:
Cast(input) -> (output)
Attributes:
to = 5
Inputs:
input: shape=(4,), dtype=bfloat16
[-3, 0, 7, 42]
Outputs:
output: shape=(4,), dtype=int16
[-3, 0, 7, 42]
test_cc_cast_BFLOAT16_to_INT32
Node:
Cast(input) -> (output)
Attributes:
to = 6
Inputs:
input: shape=(4,), dtype=bfloat16
[-3, 0, 7, 42]
Outputs:
output: shape=(4,), dtype=int32
[-3, 0, 7, 42]
test_cc_cast_BFLOAT16_to_INT64
Node:
Cast(input) -> (output)
Attributes:
to = 7
Inputs:
input: shape=(4,), dtype=bfloat16
[-3, 0, 7, 42]
Outputs:
output: shape=(4,), dtype=int64
[-3, 0, 7, 42]
test_cc_cast_BFLOAT16_to_INT8
Node:
Cast(input) -> (output)
Attributes:
to = 3
Inputs:
input: shape=(4,), dtype=bfloat16
[-3, 0, 7, 42]
Outputs:
output: shape=(4,), dtype=int8
[-3, 0, 7, 42]
test_cc_cast_BFLOAT16_to_STRING
Node:
Cast(input) -> (output)
Attributes:
to = 8
Inputs:
input: shape=(4,), dtype=bfloat16
[-3, 0, 7, 42]
Outputs:
output: shape=(4,), dtype=object
['-3', '0', '7', '42']
test_cc_cast_BFLOAT16_to_UINT16
Node:
Cast(input) -> (output)
Attributes:
to = 4
Inputs:
input: shape=(4,), dtype=bfloat16
[-3, 0, 7, 42]
Outputs:
output: shape=(4,), dtype=uint16
[65533, 0, 7, 42]
test_cc_cast_BFLOAT16_to_UINT8
Node:
Cast(input) -> (output)
Attributes:
to = 2
Inputs:
input: shape=(4,), dtype=bfloat16
[-3, 0, 7, 42]
Outputs:
output: shape=(4,), dtype=uint8
[253, 0, 7, 42]
test_cc_cast_BOOL_to_BFLOAT16
Node:
Cast(input) -> (output)
Attributes:
to = 16
Inputs:
input: shape=(4,), dtype=bool
[False, True, True, False]
Outputs:
output: shape=(4,), dtype=bfloat16
[0, 1, 1, 0]
test_cc_cast_BOOL_to_DOUBLE
Node:
Cast(input) -> (output)
Attributes:
to = 11
Inputs:
input: shape=(4,), dtype=bool
[False, True, True, False]
Outputs:
output: shape=(4,), dtype=float64
[0., 1., 1., 0.]
test_cc_cast_BOOL_to_FLOAT
Node:
Cast(input) -> (output)
Attributes:
to = 1
Inputs:
input: shape=(4,), dtype=bool
[False, True, True, False]
Outputs:
output: shape=(4,), dtype=float32
[0., 1., 1., 0.]
test_cc_cast_BOOL_to_FLOAT16
Node:
Cast(input) -> (output)
Attributes:
to = 10
Inputs:
input: shape=(4,), dtype=bool
[False, True, True, False]
Outputs:
output: shape=(4,), dtype=float16
[0., 1., 1., 0.]
test_cc_cast_BOOL_to_INT16
Node:
Cast(input) -> (output)
Attributes:
to = 5
Inputs:
input: shape=(4,), dtype=bool
[False, True, True, False]
Outputs:
output: shape=(4,), dtype=int16
[0, 1, 1, 0]
test_cc_cast_BOOL_to_INT32
Node:
Cast(input) -> (output)
Attributes:
to = 6
Inputs:
input: shape=(4,), dtype=bool
[False, True, True, False]
Outputs:
output: shape=(4,), dtype=int32
[0, 1, 1, 0]
test_cc_cast_BOOL_to_INT64
Node:
Cast(input) -> (output)
Attributes:
to = 7
Inputs:
input: shape=(4,), dtype=bool
[False, True, True, False]
Outputs:
output: shape=(4,), dtype=int64
[0, 1, 1, 0]
test_cc_cast_BOOL_to_INT8
Node:
Cast(input) -> (output)
Attributes:
to = 3
Inputs:
input: shape=(4,), dtype=bool
[False, True, True, False]
Outputs:
output: shape=(4,), dtype=int8
[0, 1, 1, 0]
test_cc_cast_BOOL_to_STRING
Node:
Cast(input) -> (output)
Attributes:
to = 8
Inputs:
input: shape=(4,), dtype=bool
[False, True, True, False]
Outputs:
output: shape=(4,), dtype=object
['0', '1', '1', '0']
test_cc_cast_BOOL_to_UINT16
Node:
Cast(input) -> (output)
Attributes:
to = 4
Inputs:
input: shape=(4,), dtype=bool
[False, True, True, False]
Outputs:
output: shape=(4,), dtype=uint16
[0, 1, 1, 0]
test_cc_cast_BOOL_to_UINT8
Node:
Cast(input) -> (output)
Attributes:
to = 2
Inputs:
input: shape=(4,), dtype=bool
[False, True, True, False]
Outputs:
output: shape=(4,), dtype=uint8
[0, 1, 1, 0]
test_cc_cast_COMPLEX128_to_COMPLEX128
Node:
Cast(input) -> (output)
Attributes:
to = 15
Inputs:
input: shape=(3,), dtype=complex128
[-1.5 -2.j , 0. +4.5j , 2.25-0.75j]
Outputs:
output: shape=(3,), dtype=complex128
[-1.5 -2.j , 0. +4.5j , 2.25-0.75j]
test_cc_cast_COMPLEX128_to_COMPLEX64
Node:
Cast(input) -> (output)
Attributes:
to = 14
Inputs:
input: shape=(3,), dtype=complex128
[-1.5 -2.j , 0. +4.5j , 2.25-0.75j]
Outputs:
output: shape=(3,), dtype=complex64
[-1.5 -2.j , 0. +4.5j , 2.25-0.75j]
test_cc_cast_COMPLEX64_to_COMPLEX128
Node:
Cast(input) -> (output)
Attributes:
to = 15
Inputs:
input: shape=(3,), dtype=complex64
[-1.5 -2.j , 0. +4.5j , 2.25-0.75j]
Outputs:
output: shape=(3,), dtype=complex128
[-1.5 -2.j , 0. +4.5j , 2.25-0.75j]
test_cc_cast_COMPLEX64_to_COMPLEX64
Node:
Cast(input) -> (output)
Attributes:
to = 14
Inputs:
input: shape=(3,), dtype=complex64
[-1.5 -2.j , 0. +4.5j , 2.25-0.75j]
Outputs:
output: shape=(3,), dtype=complex64
[-1.5 -2.j , 0. +4.5j , 2.25-0.75j]
test_cc_cast_DOUBLE_to_BFLOAT16
Node:
Cast(input) -> (output)
Attributes:
to = 16
Inputs:
input: shape=(4,), dtype=float64
[-1.5 , 0. , 2.75, 4. ]
Outputs:
output: shape=(4,), dtype=bfloat16
[-1.5, 0, 2.75, 4]
test_cc_cast_DOUBLE_to_BOOL
Node:
Cast(input) -> (output)
Attributes:
to = 9
Inputs:
input: shape=(4,), dtype=float64
[-1.5 , 0. , 2.75, 4. ]
Outputs:
output: shape=(4,), dtype=bool
[ True, False, True, True]
test_cc_cast_DOUBLE_to_COMPLEX128
Node:
Cast(input) -> (output)
Attributes:
to = 15
Inputs:
input: shape=(3,), dtype=float64
[-1.5 , 0. , 2.25]
Outputs:
output: shape=(3,), dtype=complex128
[-1.5 +0.j, 0. +0.j, 2.25+0.j]
test_cc_cast_DOUBLE_to_COMPLEX64
Node:
Cast(input) -> (output)
Attributes:
to = 14
Inputs:
input: shape=(3,), dtype=float64
[-1.5 , 0. , 2.25]
Outputs:
output: shape=(3,), dtype=complex64
[-1.5 +0.j, 0. +0.j, 2.25+0.j]
test_cc_cast_DOUBLE_to_FLOAT
Node:
Cast(input) -> (output)
Attributes:
to = 1
Inputs:
input: shape=(4,), dtype=float64
[-1.5 , 0. , 2.75, 4. ]
Outputs:
output: shape=(4,), dtype=float32
[-1.5 , 0. , 2.75, 4. ]
test_cc_cast_DOUBLE_to_FLOAT16
Node:
Cast(input) -> (output)
Attributes:
to = 10
Inputs:
input: shape=(4,), dtype=float64
[-1.5 , 0. , 2.75, 4. ]
Outputs:
output: shape=(4,), dtype=float16
[-1.5 , 0. , 2.75, 4. ]
test_cc_cast_DOUBLE_to_INT16
Node:
Cast(input) -> (output)
Attributes:
to = 5
Inputs:
input: shape=(4,), dtype=float64
[-1.5 , 0. , 2.75, 4. ]
Outputs:
output: shape=(4,), dtype=int16
[-1, 0, 2, 4]
test_cc_cast_DOUBLE_to_INT32
Node:
Cast(input) -> (output)
Attributes:
to = 6
Inputs:
input: shape=(4,), dtype=float64
[-1.5 , 0. , 2.75, 4. ]
Outputs:
output: shape=(4,), dtype=int32
[-1, 0, 2, 4]
test_cc_cast_DOUBLE_to_INT64
Node:
Cast(input) -> (output)
Attributes:
to = 7
Inputs:
input: shape=(4,), dtype=float64
[-1.5 , 0. , 2.75, 4. ]
Outputs:
output: shape=(4,), dtype=int64
[-1, 0, 2, 4]
test_cc_cast_DOUBLE_to_INT8
Node:
Cast(input) -> (output)
Attributes:
to = 3
Inputs:
input: shape=(4,), dtype=float64
[-1.5 , 0. , 2.75, 4. ]
Outputs:
output: shape=(4,), dtype=int8
[-1, 0, 2, 4]
test_cc_cast_DOUBLE_to_STRING
Node:
Cast(input) -> (output)
Attributes:
to = 8
Inputs:
input: shape=(4,), dtype=float64
[-1.5 , 0. , 2.75, 4. ]
Outputs:
output: shape=(4,), dtype=object
['-1.5', '0', '2.75', '4']
test_cc_cast_DOUBLE_to_UINT16
Node:
Cast(input) -> (output)
Attributes:
to = 4
Inputs:
input: shape=(4,), dtype=float64
[-1.5 , 0. , 2.75, 4. ]
Outputs:
output: shape=(4,), dtype=uint16
[65535, 0, 2, 4]
test_cc_cast_DOUBLE_to_UINT8
Node:
Cast(input) -> (output)
Attributes:
to = 2
Inputs:
input: shape=(4,), dtype=float64
[-1.5 , 0. , 2.75, 4. ]
Outputs:
output: shape=(4,), dtype=uint8
[255, 0, 2, 4]
test_cc_cast_FLOAT16_to_BFLOAT16
Node:
Cast(input) -> (output)
Attributes:
to = 16
Inputs:
input: shape=(4,), dtype=float16
[-1.5 , 0. , 2.75, 4. ]
Outputs:
output: shape=(4,), dtype=bfloat16
[-1.5, 0, 2.75, 4]
test_cc_cast_FLOAT16_to_BOOL
Node:
Cast(input) -> (output)
Attributes:
to = 9
Inputs:
input: shape=(4,), dtype=float16
[-1.5 , 0. , 2.75, 4. ]
Outputs:
output: shape=(4,), dtype=bool
[ True, False, True, True]
test_cc_cast_FLOAT16_to_DOUBLE
Node:
Cast(input) -> (output)
Attributes:
to = 11
Inputs:
input: shape=(4,), dtype=float16
[-1.5 , 0. , 2.75, 4. ]
Outputs:
output: shape=(4,), dtype=float64
[-1.5 , 0. , 2.75, 4. ]
test_cc_cast_FLOAT16_to_FLOAT
Node:
Cast(input) -> (output)
Attributes:
to = 1
Inputs:
input: shape=(4,), dtype=float16
[-1.5 , 0. , 2.75, 4. ]
Outputs:
output: shape=(4,), dtype=float32
[-1.5 , 0. , 2.75, 4. ]
test_cc_cast_FLOAT16_to_INT16
Node:
Cast(input) -> (output)
Attributes:
to = 5
Inputs:
input: shape=(4,), dtype=float16
[-1.5 , 0. , 2.75, 4. ]
Outputs:
output: shape=(4,), dtype=int16
[-1, 0, 2, 4]
test_cc_cast_FLOAT16_to_INT32
Node:
Cast(input) -> (output)
Attributes:
to = 6
Inputs:
input: shape=(4,), dtype=float16
[-1.5 , 0. , 2.75, 4. ]
Outputs:
output: shape=(4,), dtype=int32
[-1, 0, 2, 4]
test_cc_cast_FLOAT16_to_INT64
Node:
Cast(input) -> (output)
Attributes:
to = 7
Inputs:
input: shape=(4,), dtype=float16
[-1.5 , 0. , 2.75, 4. ]
Outputs:
output: shape=(4,), dtype=int64
[-1, 0, 2, 4]
test_cc_cast_FLOAT16_to_INT8
Node:
Cast(input) -> (output)
Attributes:
to = 3
Inputs:
input: shape=(4,), dtype=float16
[-1.5 , 0. , 2.75, 4. ]
Outputs:
output: shape=(4,), dtype=int8
[-1, 0, 2, 4]
test_cc_cast_FLOAT16_to_STRING
Node:
Cast(input) -> (output)
Attributes:
to = 8
Inputs:
input: shape=(4,), dtype=float16
[-1.5 , 0. , 2.75, 4. ]
Outputs:
output: shape=(4,), dtype=object
['-1.5', '0', '2.75', '4']
test_cc_cast_FLOAT16_to_UINT16
Node:
Cast(input) -> (output)
Attributes:
to = 4
Inputs:
input: shape=(4,), dtype=float16
[-1.5 , 0. , 2.75, 4. ]
Outputs:
output: shape=(4,), dtype=uint16
[65535, 0, 2, 4]
test_cc_cast_FLOAT16_to_UINT8
Node:
Cast(input) -> (output)
Attributes:
to = 2
Inputs:
input: shape=(4,), dtype=float16
[-1.5 , 0. , 2.75, 4. ]
Outputs:
output: shape=(4,), dtype=uint8
[255, 0, 2, 4]
test_cc_cast_FLOAT_to_BFLOAT16
Node:
Cast(input) -> (output)
Attributes:
to = 16
Inputs:
input: shape=(4,), dtype=float32
[-1.5 , 0. , 2.75, 4. ]
Outputs:
output: shape=(4,), dtype=bfloat16
[-1.5, 0, 2.75, 4]
test_cc_cast_FLOAT_to_BOOL
Node:
Cast(input) -> (output)
Attributes:
to = 9
Inputs:
input: shape=(4,), dtype=float32
[-1.5 , 0. , 2.75, 4. ]
Outputs:
output: shape=(4,), dtype=bool
[ True, False, True, True]
test_cc_cast_FLOAT_to_COMPLEX128
Node:
Cast(input) -> (output)
Attributes:
to = 15
Inputs:
input: shape=(3,), dtype=float32
[-1.5 , 0. , 2.25]
Outputs:
output: shape=(3,), dtype=complex128
[-1.5 +0.j, 0. +0.j, 2.25+0.j]
test_cc_cast_FLOAT_to_COMPLEX64
Node:
Cast(input) -> (output)
Attributes:
to = 14
Inputs:
input: shape=(3,), dtype=float32
[-1.5 , 0. , 2.25]
Outputs:
output: shape=(3,), dtype=complex64
[-1.5 +0.j, 0. +0.j, 2.25+0.j]
test_cc_cast_FLOAT_to_DOUBLE
Node:
Cast(input) -> (output)
Attributes:
to = 11
Inputs:
input: shape=(4,), dtype=float32
[-1.5 , 0. , 2.75, 4. ]
Outputs:
output: shape=(4,), dtype=float64
[-1.5 , 0. , 2.75, 4. ]
test_cc_cast_FLOAT_to_FLOAT16
Node:
Cast(input) -> (output)
Attributes:
to = 10
Inputs:
input: shape=(4,), dtype=float32
[-1.5 , 0. , 2.75, 4. ]
Outputs:
output: shape=(4,), dtype=float16
[-1.5 , 0. , 2.75, 4. ]
test_cc_cast_FLOAT_to_INT16
Node:
Cast(input) -> (output)
Attributes:
to = 5
Inputs:
input: shape=(4,), dtype=float32
[-1.5 , 0. , 2.75, 4. ]
Outputs:
output: shape=(4,), dtype=int16
[-1, 0, 2, 4]
test_cc_cast_FLOAT_to_INT32
Node:
Cast(input) -> (output)
Attributes:
to = 6
Inputs:
input: shape=(4,), dtype=float32
[-1.5 , 0. , 2.75, 4. ]
Outputs:
output: shape=(4,), dtype=int32
[-1, 0, 2, 4]
test_cc_cast_FLOAT_to_INT64
Node:
Cast(input) -> (output)
Attributes:
to = 7
Inputs:
input: shape=(4,), dtype=float32
[-1.5 , 0. , 2.75, 4. ]
Outputs:
output: shape=(4,), dtype=int64
[-1, 0, 2, 4]
test_cc_cast_FLOAT_to_INT8
Node:
Cast(input) -> (output)
Attributes:
to = 3
Inputs:
input: shape=(4,), dtype=float32
[-1.5 , 0. , 2.75, 4. ]
Outputs:
output: shape=(4,), dtype=int8
[-1, 0, 2, 4]
test_cc_cast_FLOAT_to_STRING
Node:
Cast(input) -> (output)
Attributes:
to = 8
Inputs:
input: shape=(4,), dtype=float32
[-1.5 , 0. , 2.75, 4. ]
Outputs:
output: shape=(4,), dtype=object
['-1.5', '0', '2.75', '4']
test_cc_cast_FLOAT_to_UINT16
Node:
Cast(input) -> (output)
Attributes:
to = 4
Inputs:
input: shape=(4,), dtype=float32
[-1.5 , 0. , 2.75, 4. ]
Outputs:
output: shape=(4,), dtype=uint16
[65535, 0, 2, 4]
test_cc_cast_FLOAT_to_UINT8
Node:
Cast(input) -> (output)
Attributes:
to = 2
Inputs:
input: shape=(4,), dtype=float32
[-1.5 , 0. , 2.75, 4. ]
Outputs:
output: shape=(4,), dtype=uint8
[255, 0, 2, 4]
test_cc_cast_INT16_to_BFLOAT16
Node:
Cast(input) -> (output)
Attributes:
to = 16
Inputs:
input: shape=(4,), dtype=int16
[-3, 0, 7, 42]
Outputs:
output: shape=(4,), dtype=bfloat16
[-3, 0, 7, 42]
test_cc_cast_INT16_to_BOOL
Node:
Cast(input) -> (output)
Attributes:
to = 9
Inputs:
input: shape=(4,), dtype=int16
[-3, 0, 7, 42]
Outputs:
output: shape=(4,), dtype=bool
[ True, False, True, True]
test_cc_cast_INT16_to_DOUBLE
Node:
Cast(input) -> (output)
Attributes:
to = 11
Inputs:
input: shape=(4,), dtype=int16
[-3, 0, 7, 42]
Outputs:
output: shape=(4,), dtype=float64
[-3., 0., 7., 42.]
test_cc_cast_INT16_to_FLOAT
Node:
Cast(input) -> (output)
Attributes:
to = 1
Inputs:
input: shape=(4,), dtype=int16
[-3, 0, 7, 42]
Outputs:
output: shape=(4,), dtype=float32
[-3., 0., 7., 42.]
test_cc_cast_INT16_to_FLOAT16
Node:
Cast(input) -> (output)
Attributes:
to = 10
Inputs:
input: shape=(4,), dtype=int16
[-3, 0, 7, 42]
Outputs:
output: shape=(4,), dtype=float16
[-3., 0., 7., 42.]
test_cc_cast_INT16_to_INT32
Node:
Cast(input) -> (output)
Attributes:
to = 6
Inputs:
input: shape=(4,), dtype=int16
[-3, 0, 7, 42]
Outputs:
output: shape=(4,), dtype=int32
[-3, 0, 7, 42]
test_cc_cast_INT16_to_INT64
Node:
Cast(input) -> (output)
Attributes:
to = 7
Inputs:
input: shape=(4,), dtype=int16
[-3, 0, 7, 42]
Outputs:
output: shape=(4,), dtype=int64
[-3, 0, 7, 42]
test_cc_cast_INT16_to_INT8
Node:
Cast(input) -> (output)
Attributes:
to = 3
Inputs:
input: shape=(4,), dtype=int16
[-3, 0, 7, 42]
Outputs:
output: shape=(4,), dtype=int8
[-3, 0, 7, 42]
test_cc_cast_INT16_to_STRING
Node:
Cast(input) -> (output)
Attributes:
to = 8
Inputs:
input: shape=(4,), dtype=int16
[-3, 0, 7, 42]
Outputs:
output: shape=(4,), dtype=object
['-3', '0', '7', '42']
test_cc_cast_INT16_to_UINT16
Node:
Cast(input) -> (output)
Attributes:
to = 4
Inputs:
input: shape=(4,), dtype=int16
[-3, 0, 7, 42]
Outputs:
output: shape=(4,), dtype=uint16
[65533, 0, 7, 42]
test_cc_cast_INT16_to_UINT8
Node:
Cast(input) -> (output)
Attributes:
to = 2
Inputs:
input: shape=(4,), dtype=int16
[-3, 0, 7, 42]
Outputs:
output: shape=(4,), dtype=uint8
[253, 0, 7, 42]
test_cc_cast_INT32_to_BFLOAT16
Node:
Cast(input) -> (output)
Attributes:
to = 16
Inputs:
input: shape=(4,), dtype=int32
[-3, 0, 7, 42]
Outputs:
output: shape=(4,), dtype=bfloat16
[-3, 0, 7, 42]
test_cc_cast_INT32_to_BOOL
Node:
Cast(input) -> (output)
Attributes:
to = 9
Inputs:
input: shape=(4,), dtype=int32
[-3, 0, 7, 42]
Outputs:
output: shape=(4,), dtype=bool
[ True, False, True, True]
test_cc_cast_INT32_to_DOUBLE
Node:
Cast(input) -> (output)
Attributes:
to = 11
Inputs:
input: shape=(4,), dtype=int32
[-3, 0, 7, 42]
Outputs:
output: shape=(4,), dtype=float64
[-3., 0., 7., 42.]
test_cc_cast_INT32_to_FLOAT
Node:
Cast(input) -> (output)
Attributes:
to = 1
Inputs:
input: shape=(4,), dtype=int32
[-3, 0, 7, 42]
Outputs:
output: shape=(4,), dtype=float32
[-3., 0., 7., 42.]
test_cc_cast_INT32_to_FLOAT16
Node:
Cast(input) -> (output)
Attributes:
to = 10
Inputs:
input: shape=(4,), dtype=int32
[-3, 0, 7, 42]
Outputs:
output: shape=(4,), dtype=float16
[-3., 0., 7., 42.]
test_cc_cast_INT32_to_INT16
Node:
Cast(input) -> (output)
Attributes:
to = 5
Inputs:
input: shape=(4,), dtype=int32
[-3, 0, 7, 42]
Outputs:
output: shape=(4,), dtype=int16
[-3, 0, 7, 42]
test_cc_cast_INT32_to_INT64
Node:
Cast(input) -> (output)
Attributes:
to = 7
Inputs:
input: shape=(4,), dtype=int32
[-3, 0, 7, 42]
Outputs:
output: shape=(4,), dtype=int64
[-3, 0, 7, 42]
test_cc_cast_INT32_to_INT8
Node:
Cast(input) -> (output)
Attributes:
to = 3
Inputs:
input: shape=(4,), dtype=int32
[-3, 0, 7, 42]
Outputs:
output: shape=(4,), dtype=int8
[-3, 0, 7, 42]
test_cc_cast_INT32_to_STRING
Node:
Cast(input) -> (output)
Attributes:
to = 8
Inputs:
input: shape=(4,), dtype=int32
[-3, 0, 7, 42]
Outputs:
output: shape=(4,), dtype=object
['-3', '0', '7', '42']
test_cc_cast_INT32_to_UINT16
Node:
Cast(input) -> (output)
Attributes:
to = 4
Inputs:
input: shape=(4,), dtype=int32
[-3, 0, 7, 42]
Outputs:
output: shape=(4,), dtype=uint16
[65533, 0, 7, 42]
test_cc_cast_INT32_to_UINT8
Node:
Cast(input) -> (output)
Attributes:
to = 2
Inputs:
input: shape=(4,), dtype=int32
[-3, 0, 7, 42]
Outputs:
output: shape=(4,), dtype=uint8
[253, 0, 7, 42]
test_cc_cast_INT64_to_BFLOAT16
Node:
Cast(input) -> (output)
Attributes:
to = 16
Inputs:
input: shape=(4,), dtype=int64
[-3, 0, 7, 42]
Outputs:
output: shape=(4,), dtype=bfloat16
[-3, 0, 7, 42]
test_cc_cast_INT64_to_BOOL
Node:
Cast(input) -> (output)
Attributes:
to = 9
Inputs:
input: shape=(4,), dtype=int64
[-3, 0, 7, 42]
Outputs:
output: shape=(4,), dtype=bool
[ True, False, True, True]
test_cc_cast_INT64_to_DOUBLE
Node:
Cast(input) -> (output)
Attributes:
to = 11
Inputs:
input: shape=(4,), dtype=int64
[-3, 0, 7, 42]
Outputs:
output: shape=(4,), dtype=float64
[-3., 0., 7., 42.]
test_cc_cast_INT64_to_FLOAT
Node:
Cast(input) -> (output)
Attributes:
to = 1
Inputs:
input: shape=(4,), dtype=int64
[-3, 0, 7, 42]
Outputs:
output: shape=(4,), dtype=float32
[-3., 0., 7., 42.]
test_cc_cast_INT64_to_FLOAT16
Node:
Cast(input) -> (output)
Attributes:
to = 10
Inputs:
input: shape=(4,), dtype=int64
[-3, 0, 7, 42]
Outputs:
output: shape=(4,), dtype=float16
[-3., 0., 7., 42.]
test_cc_cast_INT64_to_INT16
Node:
Cast(input) -> (output)
Attributes:
to = 5
Inputs:
input: shape=(4,), dtype=int64
[-3, 0, 7, 42]
Outputs:
output: shape=(4,), dtype=int16
[-3, 0, 7, 42]
test_cc_cast_INT64_to_INT32
Node:
Cast(input) -> (output)
Attributes:
to = 6
Inputs:
input: shape=(4,), dtype=int64
[-3, 0, 7, 42]
Outputs:
output: shape=(4,), dtype=int32
[-3, 0, 7, 42]
test_cc_cast_INT64_to_INT8
Node:
Cast(input) -> (output)
Attributes:
to = 3
Inputs:
input: shape=(4,), dtype=int64
[-3, 0, 7, 42]
Outputs:
output: shape=(4,), dtype=int8
[-3, 0, 7, 42]
test_cc_cast_INT64_to_STRING
Node:
Cast(input) -> (output)
Attributes:
to = 8
Inputs:
input: shape=(4,), dtype=int64
[-3, 0, 7, 42]
Outputs:
output: shape=(4,), dtype=object
['-3', '0', '7', '42']
test_cc_cast_INT64_to_UINT16
Node:
Cast(input) -> (output)
Attributes:
to = 4
Inputs:
input: shape=(4,), dtype=int64
[-3, 0, 7, 42]
Outputs:
output: shape=(4,), dtype=uint16
[65533, 0, 7, 42]
test_cc_cast_INT64_to_UINT8
Node:
Cast(input) -> (output)
Attributes:
to = 2
Inputs:
input: shape=(4,), dtype=int64
[-3, 0, 7, 42]
Outputs:
output: shape=(4,), dtype=uint8
[253, 0, 7, 42]
test_cc_cast_INT8_to_BFLOAT16
Node:
Cast(input) -> (output)
Attributes:
to = 16
Inputs:
input: shape=(4,), dtype=int8
[-3, 0, 7, 42]
Outputs:
output: shape=(4,), dtype=bfloat16
[-3, 0, 7, 42]
test_cc_cast_INT8_to_BOOL
Node:
Cast(input) -> (output)
Attributes:
to = 9
Inputs:
input: shape=(4,), dtype=int8
[-3, 0, 7, 42]
Outputs:
output: shape=(4,), dtype=bool
[ True, False, True, True]
test_cc_cast_INT8_to_DOUBLE
Node:
Cast(input) -> (output)
Attributes:
to = 11
Inputs:
input: shape=(4,), dtype=int8
[-3, 0, 7, 42]
Outputs:
output: shape=(4,), dtype=float64
[-3., 0., 7., 42.]
test_cc_cast_INT8_to_FLOAT
Node:
Cast(input) -> (output)
Attributes:
to = 1
Inputs:
input: shape=(4,), dtype=int8
[-3, 0, 7, 42]
Outputs:
output: shape=(4,), dtype=float32
[-3., 0., 7., 42.]
test_cc_cast_INT8_to_FLOAT16
Node:
Cast(input) -> (output)
Attributes:
to = 10
Inputs:
input: shape=(4,), dtype=int8
[-3, 0, 7, 42]
Outputs:
output: shape=(4,), dtype=float16
[-3., 0., 7., 42.]
test_cc_cast_INT8_to_INT16
Node:
Cast(input) -> (output)
Attributes:
to = 5
Inputs:
input: shape=(4,), dtype=int8
[-3, 0, 7, 42]
Outputs:
output: shape=(4,), dtype=int16
[-3, 0, 7, 42]
test_cc_cast_INT8_to_INT32
Node:
Cast(input) -> (output)
Attributes:
to = 6
Inputs:
input: shape=(4,), dtype=int8
[-3, 0, 7, 42]
Outputs:
output: shape=(4,), dtype=int32
[-3, 0, 7, 42]
test_cc_cast_INT8_to_INT64
Node:
Cast(input) -> (output)
Attributes:
to = 7
Inputs:
input: shape=(4,), dtype=int8
[-3, 0, 7, 42]
Outputs:
output: shape=(4,), dtype=int64
[-3, 0, 7, 42]
test_cc_cast_INT8_to_STRING
Node:
Cast(input) -> (output)
Attributes:
to = 8
Inputs:
input: shape=(4,), dtype=int8
[-3, 0, 7, 42]
Outputs:
output: shape=(4,), dtype=object
['-3', '0', '7', '42']
test_cc_cast_INT8_to_UINT16
Node:
Cast(input) -> (output)
Attributes:
to = 4
Inputs:
input: shape=(4,), dtype=int8
[-3, 0, 7, 42]
Outputs:
output: shape=(4,), dtype=uint16
[65533, 0, 7, 42]
test_cc_cast_INT8_to_UINT8
Node:
Cast(input) -> (output)
Attributes:
to = 2
Inputs:
input: shape=(4,), dtype=int8
[-3, 0, 7, 42]
Outputs:
output: shape=(4,), dtype=uint8
[253, 0, 7, 42]
test_cc_cast_STRING_to_BFLOAT16
Node:
Cast(input) -> (output)
Attributes:
to = 16
Inputs:
input: shape=(4,), dtype=object
['-3', '0', '7', '42']
Outputs:
output: shape=(4,), dtype=bfloat16
[-3, 0, 7, 42]
test_cc_cast_STRING_to_BOOL
Node:
Cast(input) -> (output)
Attributes:
to = 9
Inputs:
input: shape=(4,), dtype=object
['-3', '0', '7', '42']
Outputs:
output: shape=(4,), dtype=bool
[ True, False, True, True]
test_cc_cast_STRING_to_DOUBLE
Node:
Cast(input) -> (output)
Attributes:
to = 11
Inputs:
input: shape=(4,), dtype=object
['-3', '0', '7', '42']
Outputs:
output: shape=(4,), dtype=float64
[-3., 0., 7., 42.]
test_cc_cast_STRING_to_FLOAT
Node:
Cast(input) -> (output)
Attributes:
to = 1
Inputs:
input: shape=(4,), dtype=object
['-3', '0', '7', '42']
Outputs:
output: shape=(4,), dtype=float32
[-3., 0., 7., 42.]
test_cc_cast_STRING_to_FLOAT16
Node:
Cast(input) -> (output)
Attributes:
to = 10
Inputs:
input: shape=(4,), dtype=object
['-3', '0', '7', '42']
Outputs:
output: shape=(4,), dtype=float16
[-3., 0., 7., 42.]
test_cc_cast_STRING_to_INT16
Node:
Cast(input) -> (output)
Attributes:
to = 5
Inputs:
input: shape=(4,), dtype=object
['-3', '0', '7', '42']
Outputs:
output: shape=(4,), dtype=int16
[-3, 0, 7, 42]
test_cc_cast_STRING_to_INT32
Node:
Cast(input) -> (output)
Attributes:
to = 6
Inputs:
input: shape=(4,), dtype=object
['-3', '0', '7', '42']
Outputs:
output: shape=(4,), dtype=int32
[-3, 0, 7, 42]
test_cc_cast_STRING_to_INT64
Node:
Cast(input) -> (output)
Attributes:
to = 7
Inputs:
input: shape=(4,), dtype=object
['-3', '0', '7', '42']
Outputs:
output: shape=(4,), dtype=int64
[-3, 0, 7, 42]
test_cc_cast_STRING_to_INT8
Node:
Cast(input) -> (output)
Attributes:
to = 3
Inputs:
input: shape=(4,), dtype=object
['-3', '0', '7', '42']
Outputs:
output: shape=(4,), dtype=int8
[-3, 0, 7, 42]
test_cc_cast_STRING_to_UINT16
Node:
Cast(input) -> (output)
Attributes:
to = 4
Inputs:
input: shape=(4,), dtype=object
['-3', '0', '7', '42']
Outputs:
output: shape=(4,), dtype=uint16
[65533, 0, 7, 42]
test_cc_cast_STRING_to_UINT8
Node:
Cast(input) -> (output)
Attributes:
to = 2
Inputs:
input: shape=(4,), dtype=object
['-3', '0', '7', '42']
Outputs:
output: shape=(4,), dtype=uint8
[253, 0, 7, 42]
test_cc_cast_UINT16_to_BFLOAT16
Node:
Cast(input) -> (output)
Attributes:
to = 16
Inputs:
input: shape=(4,), dtype=uint16
[ 0, 1, 7, 42]
Outputs:
output: shape=(4,), dtype=bfloat16
[0, 1, 7, 42]
test_cc_cast_UINT16_to_BOOL
Node:
Cast(input) -> (output)
Attributes:
to = 9
Inputs:
input: shape=(4,), dtype=uint16
[ 0, 1, 7, 42]
Outputs:
output: shape=(4,), dtype=bool
[False, True, True, True]
test_cc_cast_UINT16_to_DOUBLE
Node:
Cast(input) -> (output)
Attributes:
to = 11
Inputs:
input: shape=(4,), dtype=uint16
[ 0, 1, 7, 42]
Outputs:
output: shape=(4,), dtype=float64
[ 0., 1., 7., 42.]
test_cc_cast_UINT16_to_FLOAT
Node:
Cast(input) -> (output)
Attributes:
to = 1
Inputs:
input: shape=(4,), dtype=uint16
[ 0, 1, 7, 42]
Outputs:
output: shape=(4,), dtype=float32
[ 0., 1., 7., 42.]
test_cc_cast_UINT16_to_FLOAT16
Node:
Cast(input) -> (output)
Attributes:
to = 10
Inputs:
input: shape=(4,), dtype=uint16
[ 0, 1, 7, 42]
Outputs:
output: shape=(4,), dtype=float16
[ 0., 1., 7., 42.]
test_cc_cast_UINT16_to_INT16
Node:
Cast(input) -> (output)
Attributes:
to = 5
Inputs:
input: shape=(4,), dtype=uint16
[ 0, 1, 7, 42]
Outputs:
output: shape=(4,), dtype=int16
[ 0, 1, 7, 42]
test_cc_cast_UINT16_to_INT32
Node:
Cast(input) -> (output)
Attributes:
to = 6
Inputs:
input: shape=(4,), dtype=uint16
[ 0, 1, 7, 42]
Outputs:
output: shape=(4,), dtype=int32
[ 0, 1, 7, 42]
test_cc_cast_UINT16_to_INT64
Node:
Cast(input) -> (output)
Attributes:
to = 7
Inputs:
input: shape=(4,), dtype=uint16
[ 0, 1, 7, 42]
Outputs:
output: shape=(4,), dtype=int64
[ 0, 1, 7, 42]
test_cc_cast_UINT16_to_INT8
Node:
Cast(input) -> (output)
Attributes:
to = 3
Inputs:
input: shape=(4,), dtype=uint16
[ 0, 1, 7, 42]
Outputs:
output: shape=(4,), dtype=int8
[ 0, 1, 7, 42]
test_cc_cast_UINT16_to_STRING
Node:
Cast(input) -> (output)
Attributes:
to = 8
Inputs:
input: shape=(4,), dtype=uint16
[ 0, 1, 7, 42]
Outputs:
output: shape=(4,), dtype=object
['0', '1', '7', '42']
test_cc_cast_UINT16_to_UINT8
Node:
Cast(input) -> (output)
Attributes:
to = 2
Inputs:
input: shape=(4,), dtype=uint16
[ 0, 1, 7, 42]
Outputs:
output: shape=(4,), dtype=uint8
[ 0, 1, 7, 42]
test_cc_cast_UINT8_to_BFLOAT16
Node:
Cast(input) -> (output)
Attributes:
to = 16
Inputs:
input: shape=(4,), dtype=uint8
[ 0, 1, 7, 42]
Outputs:
output: shape=(4,), dtype=bfloat16
[0, 1, 7, 42]
test_cc_cast_UINT8_to_BOOL
Node:
Cast(input) -> (output)
Attributes:
to = 9
Inputs:
input: shape=(4,), dtype=uint8
[ 0, 1, 7, 42]
Outputs:
output: shape=(4,), dtype=bool
[False, True, True, True]
test_cc_cast_UINT8_to_DOUBLE
Node:
Cast(input) -> (output)
Attributes:
to = 11
Inputs:
input: shape=(4,), dtype=uint8
[ 0, 1, 7, 42]
Outputs:
output: shape=(4,), dtype=float64
[ 0., 1., 7., 42.]
test_cc_cast_UINT8_to_FLOAT
Node:
Cast(input) -> (output)
Attributes:
to = 1
Inputs:
input: shape=(4,), dtype=uint8
[ 0, 1, 7, 42]
Outputs:
output: shape=(4,), dtype=float32
[ 0., 1., 7., 42.]
test_cc_cast_UINT8_to_FLOAT16
Node:
Cast(input) -> (output)
Attributes:
to = 10
Inputs:
input: shape=(4,), dtype=uint8
[ 0, 1, 7, 42]
Outputs:
output: shape=(4,), dtype=float16
[ 0., 1., 7., 42.]
test_cc_cast_UINT8_to_INT16
Node:
Cast(input) -> (output)
Attributes:
to = 5
Inputs:
input: shape=(4,), dtype=uint8
[ 0, 1, 7, 42]
Outputs:
output: shape=(4,), dtype=int16
[ 0, 1, 7, 42]
test_cc_cast_UINT8_to_INT32
Node:
Cast(input) -> (output)
Attributes:
to = 6
Inputs:
input: shape=(4,), dtype=uint8
[ 0, 1, 7, 42]
Outputs:
output: shape=(4,), dtype=int32
[ 0, 1, 7, 42]
test_cc_cast_UINT8_to_INT64
Node:
Cast(input) -> (output)
Attributes:
to = 7
Inputs:
input: shape=(4,), dtype=uint8
[ 0, 1, 7, 42]
Outputs:
output: shape=(4,), dtype=int64
[ 0, 1, 7, 42]
test_cc_cast_UINT8_to_INT8
Node:
Cast(input) -> (output)
Attributes:
to = 3
Inputs:
input: shape=(4,), dtype=uint8
[ 0, 1, 7, 42]
Outputs:
output: shape=(4,), dtype=int8
[ 0, 1, 7, 42]
test_cc_cast_UINT8_to_STRING
Node:
Cast(input) -> (output)
Attributes:
to = 8
Inputs:
input: shape=(4,), dtype=uint8
[ 0, 1, 7, 42]
Outputs:
output: shape=(4,), dtype=object
['0', '1', '7', '42']
test_cc_cast_UINT8_to_UINT16
Node:
Cast(input) -> (output)
Attributes:
to = 4
Inputs:
input: shape=(4,), dtype=uint8
[ 0, 1, 7, 42]
Outputs:
output: shape=(4,), dtype=uint16
[ 0, 1, 7, 42]
Differences with previous version (13)#
SchemaDiff: Cast (domain 'ai.onnx')
old version: 13
new version: 19
breaking: no
Attributes:
added ‘saturate’: type=INT; required=False; default=1
Type constraints:
changed ‘T1’: added types: [‘tensor(float8e4m3fn)’, ‘tensor(float8e4m3fnuz)’, ‘tensor(float8e5m2)’, ‘tensor(float8e5m2fnuz)’]
changed ‘T2’: added types: [‘tensor(float8e4m3fn)’, ‘tensor(float8e4m3fnuz)’, ‘tensor(float8e5m2)’, ‘tensor(float8e5m2fnuz)’]