TVTensor — Torchvision 0.22 documentation (original) (raw)

class torchvision.tv_tensors.TVTensor[source]

Base class for all TVTensors.

You probably don’t want to use this class unless you’re defining your own custom TVTensors. SeeHow to write your own TVTensor class for details.

Examples using TVTensor:

property device_: device_

Is the torch.device where this Tensor is.

property ndim_: int_

Alias for dim()

property shape_: Union[Size, list[int], tuple[int, ...]]_

Returns the size of the self tensor. Alias for size.

See also Tensor.size().

Example:

t = torch.empty(3, 4, 5) t.size() torch.Size([3, 4, 5]) t.shape torch.Size([3, 4, 5])