DataTypeΒΆ
- class onnx_ir.DataType(value)ΒΆ
Enum for the data types of ONNX tensors, defined in
onnx.TensorProto
.- property bitwidth: intΒΆ
Returns the bit width of the data type.
Added in version 0.1.2.
- Raises:
TypeError β If the data type is not supported.
- property exponent_bitwidth: intΒΆ
Returns the bit width of the exponent for floating-point types.
Added in version 0.1.8.
- Raises:
TypeError β If the data type is not supported.
- property mantissa_bitwidth: intΒΆ
Returns the bit width of the mantissa for floating-point types.
Added in version 0.1.8.
- Raises:
TypeError β If the data type is not supported.
- property eps: int | floating[Any]ΒΆ
Returns the difference between 1.0 and the next smallest representable float larger than 1.0 for the ONNX data type.
Returns 1 for integers.
Added in version 0.1.8.
- Raises:
TypeError β If the data type is not a numeric data type.
- property tiny: int | floating[Any]ΒΆ
Returns the smallest positive non-zero value for the ONNX data type.
Returns 1 for integers.
Added in version 0.1.8.
- Raises:
TypeError β If the data type is not a numeric data type.
- property min: int | floating[Any]ΒΆ
Returns the minimum representable value for the ONNX data type.
Added in version 0.1.8.
- Raises:
TypeError β If the data type is not a numeric data type.
- property max: int | floating[Any]ΒΆ
Returns the maximum representable value for the ONNX data type.
Added in version 0.1.8.
- Raises:
TypeError β If the data type is not a numeric data type.
- property precision: intΒΆ
Returns the precision for the ONNX dtype if supported.
For floats returns the approximate number of decimal digits to which this kind of float is precise. Returns 0 for integers.
Added in version 0.1.8.
- Raises:
TypeError β If the data type is not a numeric data type.
- property resolution: int | floating[Any]ΒΆ
Returns the resolution for the ONNX dtype if supported.
- Returns the approximate decimal resolution of this type, i.e.,
10**-precision. Returns 1 for integers.
Added in version 0.1.8.
- Raises:
TypeError β If the data type is not a numeric data type.
- short_name()[source]ΒΆ
Returns the short name of the data type.
The short name is a string that is used to represent the data type in a more compact form. For example, the short name for DataType.FLOAT is βf32β. To get the corresponding data type back, call
from_short_name
on a string.Naming reference: https://github.com/pytorch/pytorch/blob/4bead7b85ea4160243c74109e0ce9bb80686d016/torch/utils/_dtype_abbrs.py
- is_integer()[source]ΒΆ
Returns True if the data type is an integer.
Added in version 0.1.4.
- Return type:
- is_signed()[source]ΒΆ
Returns True if the data type is a signed type.
Added in version 0.1.4.
- Return type:
- is_string()[source]ΒΆ
Returns True if the data type is a string type.
Added in version 0.1.8.
- Return type:
- UNDEFINED = 0ΒΆ
- FLOAT = 1ΒΆ
- UINT8 = 2ΒΆ
- INT8 = 3ΒΆ
- UINT16 = 4ΒΆ
- INT16 = 5ΒΆ
- INT32 = 6ΒΆ
- INT64 = 7ΒΆ
- STRING = 8ΒΆ
- BOOL = 9ΒΆ
- FLOAT16 = 10ΒΆ
- DOUBLE = 11ΒΆ
- UINT32 = 12ΒΆ
- UINT64 = 13ΒΆ
- COMPLEX64 = 14ΒΆ
- COMPLEX128 = 15ΒΆ
- BFLOAT16 = 16ΒΆ
- FLOAT8E4M3FN = 17ΒΆ
- FLOAT8E4M3FNUZ = 18ΒΆ
- FLOAT8E5M2 = 19ΒΆ
- FLOAT8E5M2FNUZ = 20ΒΆ
- UINT4 = 21ΒΆ
- INT4 = 22ΒΆ
- FLOAT4E2M1 = 23ΒΆ
- FLOAT8E8M0 = 24ΒΆ