Dtype

metatrain.utils.dtype.dtype_to_str(dtype: dtype) str[source]

Convert a torch dtype to its string representation.

Parameters:

dtype (dtype) – torch dtype to convert

Returns:

string representation of the torch dtype

Return type:

str

Example

>>> import torch
>>> dtype_to_str(torch.float64)
"float64"
>>> dtype_to_str(torch.int32)
"int32"