On this page
JitScalarType
class torch.onnx.JitScalarType(value)
-
Scalar types defined in torch.
Use
JitScalarType
to convert from torch and JIT scalar types to ONNX scalar types.- Examples::
-
>>> JitScalarType.from_name("Float").onnx_type() TensorProtoDataType.FLOAT
classmethod from_dtype(dtype)
[source]-
Convert a torch dtype to ScalarType.
- Return type:
classmethod from_name(name)
[source]-
Convert a JIT scalar type or torch type name to ScalarType.
- Parameters:
-
name (Optional[Union[typing_extensions.Literal[Byte, Char, Double, Float, Half, Int, Long, Short, Bool, ComplexHalf, ComplexFloat, ComplexDouble, QInt8, QUInt8, QInt32, BFloat16, Undefined], typing_extensions.Literal[bool, uint8_t, int8_t, double, float, half, int, int64_t, int16_t, complex32, complex64, complex128, qint8, quint8, qint32, bfloat16], str]]) – JIT scalar type name (Byte) or torch type name (uint8_t).
- Returns:
-
ScalarType.
- Raises:
-
ValueError – if name is not a valid scalar type name or if it is None.
- Return type:
onnx_compatible()
[source]-
Return whether this ScalarType is compatible with ONNX.
- Return type:
onnx_type()
[source]-
Convert a ScalarType to an ONNX data type.
- Return type:
-
TensorProtoDataType
scalar_name()
[source]-
Convert a ScalarType to a JIT scalar type name.
- Return type:
-
typing_extensions.Literal[Byte, Char, Double, Float, Half, Int, Long, Short, Bool, ComplexHalf, ComplexFloat, ComplexDouble, QInt8, QUInt8, QInt32, BFloat16, Undefined]
© 2024, PyTorch Contributors
PyTorch has a BSD-style license, as found in the LICENSE file.
https://pytorch.org/docs/1.13/generated/torch.onnx.JitScalarType.html