Rate this Page

torch.typename#

torch.typename(obj, /)[source]#

String representation of the type of an object.

This function returns a fully qualified string representation of an object’s type. :param obj: The object whose type to represent :type obj: object

Returns:

the type of the object o

Return type:

str

Example

>>> x = torch.tensor([1, 2, 3])
>>> torch.typename(x)
'torch.LongTensor'
>>> torch.typename(torch.nn.Parameter)
'torch.nn.parameter.Parameter'