Shortcuts

TVTensor

class torchvision.tv_tensors.TVTensor[source]

所有TVTensors的基类。

除非您正在定义自己的自定义TVTensor,否则您可能不希望使用此类。详情请参阅如何编写您自己的TVTensor类

使用 TVTensor 的示例:

开始使用 transforms v2

Getting started with transforms v2

Transforms v2: 端到端目标检测/分割示例

Transforms v2: End-to-end object detection/segmentation example

如何编写自己的v2转换

How to write your own v2 transforms

TVTensors 常见问题

TVTensors FAQ

如何编写你自己的TVTensor类

How to write your own TVTensor class
property device: device

这是该张量所在的torch.device

property ndim: int

dim() 的别名

property shape: Union[Size, List[int], Tuple[int, ...]]

返回self张量的大小。size的别名。

另请参阅 Tensor.size()

示例:

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