Skip to content

Commit 76a3458

Browse files
committed
Added temporary fix for channels-last-like tensors for Resize op
Fixes #4880 Description: - Added temporary fix for channels-last-like tensors for Resize op Benchmarks:
1 parent 8d25de7 commit 76a3458

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

torchvision/transforms/functional_tensor.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -541,6 +541,14 @@ def resize(
541541

542542
img, need_cast, need_squeeze, out_dtype = _cast_squeeze_in(img, [torch.float32, torch.float64])
543543

544+
# Temporary fix for channels-last-like tensor
545+
# Context: https://github.com/pytorch/vision/issues/4880 and
546+
# https://github.com/pytorch/pytorch/issues/68430
547+
# For channels-first tensor .contiguous() is no-op
548+
# For unsqueezed 3D channels-list tensor,
549+
# we transform it to contiguous 4D channels-first tensor
550+
# img = img.contiguous()
551+
544552
# Define align_corners to avoid warnings
545553
align_corners = False if interpolation in ["bilinear", "bicubic"] else None
546554

0 commit comments

Comments
 (0)