Skip to content

Commit 8984188

Browse files
simplify docstrings
1 parent 3af1d6b commit 8984188

File tree

1 file changed

+2
-19
lines changed

1 file changed

+2
-19
lines changed

torchvision/transforms/v2/_type_conversion.py

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -96,38 +96,21 @@ def transform(self, inpt: Any, params: dict[str, Any]) -> torch.Tensor:
9696

9797

9898
class ToCVCUDATensor(Transform):
99-
"""Convert a ``torch.Tensor`` with NCHW layout to a ``cvcuda.Tensor`` with NHWC layout.
99+
"""Convert a ``torch.Tensor`` with NCHW shape to a ``cvcuda.Tensor``.
100100
If the input tensor is on CPU, it will automatically be transferred to GPU.
101101
Only 1-channel and 3-channel images are supported.
102102
103103
This transform does not support torchscript.
104-
105-
Example:
106-
>>> import torch
107-
>>> from torchvision.transforms import v2
108-
>>> img_tensor = torch.randint(0, 256, (1, 3, 320, 240), dtype=torch.uint8)
109-
>>> img_cvcuda = v2.ToCVCUDATensor()(img_tensor)
110-
>>> print(img_cvcuda.shape)
111-
(1, 3, 240, 320)
112104
"""
113105

114106
def transform(self, inpt: torch.Tensor, params: dict[str, Any]) -> "cvcuda.Tensor":
115107
return F.to_cvcuda_tensor(inpt)
116108

117109

118110
class CVCUDAToTensor(Transform):
119-
"""Convert a ``cvcuda.Tensor`` with NHWC layout to a ``torch.Tensor`` with NCHW layout.
111+
"""Convert a ``cvcuda.Tensor`` to a ``torch.Tensor`` with NCHW shape.
120112
121113
This function does not support torchscript.
122-
123-
Example:
124-
>>> import cvcuda
125-
>>> from torchvision.transforms import v2
126-
>>> img_tensor = torch.randint(0, 255, (1, 240, 320, 3), dtype=torch.uint8, device="cuda")
127-
>>> img_cvcuda = cvcuda.as_tensor(img_tensor, cvcuda.TensorLayout.NHWC)
128-
>>> img_tensor = v2.CVCUDAToTensor()(img_cvcuda)
129-
>>> print(img_tensor.shape)
130-
torch.Size([1, 3, 240, 320])
131114
"""
132115

133116
try:

0 commit comments

Comments
 (0)