Shortcuts

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
dtype()[source]

Convert a ScalarType to a torch dtype.

classmethod from_dtype(dtype)[source]

Convert a torch dtype to ScalarType.

classmethod from_name(name)[source]

Convert a JIT scalar type or torch type name to ScalarType.

Parameters:

name – 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.

onnx_compatible()[source]

Return whether this ScalarType is compatible with ONNX.

onnx_type()[source]

Convert a ScalarType to an ONNX data type.

scalar_name()[source]

Convert a ScalarType to a JIT scalar type name.

torch_name()[source]

Convert a ScalarType to a torch type name.

Docs

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources