BitCast¶
BitCast - 26¶
Version¶
name: BitCast (GitHub)
domain:
mainsince_version:
26function:
Falsesupport_level:
SupportType.COMMONshape inference:
True
This version of the operator has been available since version 26.
Summary¶
Reinterprets the binary representation of a tensor as a different data type, specified by the ‘to’ attribute. Unlike Cast, BitCast preserves the exact bit pattern without any value conversion.
The target data type must have the same bit-width as the input data type. The output tensor has the same shape as the input tensor. All types except string are supported. Implementations must treat the underlying bytes as little endian.
Attributes¶
to - INT (required) :
The data type to which the input tensor is bitwise reinterpreted. Must be one of the non-string types from DataType enum in TensorProto. The target type must have the same bit-width as the input type.
Inputs¶
input (heterogeneous) - T1:
Input tensor to be bitcast.
Outputs¶
output (heterogeneous) - T2:
Output tensor with the same shape as the input.
Type Constraints¶
T1 in (
tensor(bfloat16),tensor(bool),tensor(complex128),tensor(complex64),tensor(double),tensor(float),tensor(float16),tensor(float4e2m1),tensor(float8e4m3fn),tensor(float8e4m3fnuz),tensor(float8e5m2),tensor(float8e5m2fnuz),tensor(float8e8m0),tensor(int16),tensor(int2),tensor(int32),tensor(int4),tensor(int64),tensor(int8),tensor(uint16),tensor(uint2),tensor(uint32),tensor(uint4),tensor(uint64),tensor(uint8)):Constrain input types. Bitcasting from string is not supported.
T2 in (
tensor(bfloat16),tensor(bool),tensor(complex128),tensor(complex64),tensor(double),tensor(float),tensor(float16),tensor(float4e2m1),tensor(float8e4m3fn),tensor(float8e4m3fnuz),tensor(float8e5m2),tensor(float8e5m2fnuz),tensor(float8e8m0),tensor(int16),tensor(int2),tensor(int32),tensor(int4),tensor(int64),tensor(int8),tensor(uint16),tensor(uint2),tensor(uint32),tensor(uint4),tensor(uint64),tensor(uint8)):Constrain output types. Bitcasting to string is not supported.