Skip to content

Commit a07cec3

Browse files
disable contiguous when converting to tensors
1 parent 966b53a commit a07cec3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

torchvision/transforms/v2/functional/_type_conversion.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,11 +173,11 @@ def cvcuda_to_tensor(cvcuda_img: "cvcuda.Tensor") -> torch.Tensor:
173173
if cuda_tensor.ndim == 4:
174174
# Batched multi-channel image in NHWC format
175175
# Convert NHWC -> NCHW
176-
img = cuda_tensor.permute(0, 3, 1, 2).contiguous()
176+
img = cuda_tensor.permute(0, 3, 1, 2)
177177
elif cuda_tensor.ndim == 3:
178178
# Batched single-channel image in NHW format
179179
# Convert NHW -> NCHW by adding channel dimension
180-
img = cuda_tensor.unsqueeze(1).contiguous()
180+
img = cuda_tensor.unsqueeze(1)
181181
else:
182182
raise ValueError(f"Image should be 3 or 4 dimensional. Got {cuda_tensor.ndim} dimensions.")
183183

0 commit comments

Comments
 (0)