-
Notifications
You must be signed in to change notification settings - Fork 7.2k
Description
🐛 Describe the bug
When using the resize
function, if the target size equals to the smaller side of the image, the image is returned as-is, even if the longer side exceeds the given max_size
. This can be seen at https://github.com/pytorch/vision/blob/main/torchvision/transforms/functional_pil.py#L244
import torch
import torchvision
H, W = 32, 40
img = torch.randint(256, (3, H, W))
resized_img = torchvision.transforms.functional.resize(img, H, max_size=H)
print(resized_img.shape[2]) # This is 40 instead 32
Versions
PyTorch version: 1.10.2+cu102
Is debug build: False
CUDA used to build PyTorch: 10.2
ROCM used to build PyTorch: N/A
OS: Ubuntu 20.04.3 LTS (x86_64)
GCC version: (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0
Clang version: Could not collect
CMake version: Could not collect
Libc version: glibc-2.31
Python version: 3.8.6 (default, Dec 12 2021, 11:32:40) [GCC 9.3.0] (64-bit runtime)
Python platform: Linux-5.10.60.1-microsoft-standard-WSL2-x86_64-with-glibc2.29
Is CUDA available: True
CUDA runtime version: Could not collect
GPU models and configuration: GPU 0: GeForce MX250
Nvidia driver version: 465.42
cuDNN version: Could not collect
HIP runtime version: N/A
MIOpen runtime version: N/A
Versions of relevant libraries:
[pip3] numpy==1.22.2
[pip3] torch==1.10.2
[pip3] torchvision==0.11.3
[conda] Could not collect