Closed
Description
🐛 Bug
Originally (vision/nightly), when torchvision.transforms.RandomRotation
is used with a Tensor of shape (C, H, W)
, without a fill
argument, we get a following error:
Error
Traceback (most recent call last):
File "repr1.py", line 9, in <module>
tensor = torchvision.transforms.RandomRotation(45)(tensor)
File "/home/stratum/miniconda3/envs/pytorch-cpu-nightly/lib/python3.6/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
result = self.forward(*input, **kwargs)
File "/home/stratum/miniconda3/envs/pytorch-cpu-nightly/lib/python3.6/site-packages/torchvision/transforms/transforms.py", line 1236, in forward
fill = [float(f) for f in fill]
TypeError: 'NoneType' object is not iterable
To Reproduce
Steps to reproduce the behavior:
import torch
import torchvision
tensor = torch.rand(3, 224, 224)
tensor = torchvision.transforms.RandomRotation(45)(tensor)
print(tensor.shape)
or
import torch
import torchvision
tensor = torch.rand(3, 224, 224)
transforms = torch.nn.Sequential(
torchvision.transforms.RandomRotation(45)
)
transformed = transforms(tensor)
print(tensor.shape)
Expected behavior
torch.Size([3, 224, 224])
Environment
Environment
Collecting environment information...
PyTorch version: 1.8.0.dev20210124
Is debug build: False
CUDA used to build PyTorch: Could not collect
ROCM used to build PyTorch: N/A
OS: Manjaro Linux (x86_64)
GCC version: (GCC) 10.2.0
Clang version: Could not collect
CMake version: version 3.19.3
Python version: 3.6 (64-bit runtime)
Is CUDA available: False
CUDA runtime version: Could not collect
GPU models and configuration: GPU 0: GeForce GTX 1660 Ti
Nvidia driver version: 460.32.03
cuDNN version: Probably one of the following:
/usr/lib/libcudnn.so.8.0.5
/usr/lib/libcudnn_adv_infer.so.8.0.5
/usr/lib/libcudnn_adv_train.so.8.0.5
/usr/lib/libcudnn_cnn_infer.so.8.0.5
/usr/lib/libcudnn_cnn_train.so.8.0.5
/usr/lib/libcudnn_ops_infer.so.8.0.5
/usr/lib/libcudnn_ops_train.so.8.0.5
HIP runtime version: N/A
MIOpen runtime version: N/A
Versions of relevant libraries:
[pip3] numpy==1.19.2
[pip3] torch==1.8.0.dev20210124
[pip3] torchaudio==0.8.0a0+e38b122
[pip3] torchvision==0.9.0.dev20210124
[conda] blas 1.0 mkl
[conda] cpuonly 1.0 0 pytorch-nightly
[conda] mkl 2020.2 256
[conda] mkl-service 2.3.0 py36he8ac12f_0
[conda] mkl_fft 1.2.0 py36h23d657b_0
[conda] mkl_random 1.1.1 py36h0573a6f_0
[conda] numpy 1.19.2 py36h54aff64_0
[conda] numpy-base 1.19.2 py36hfa32c7d_0
[conda] pytorch 1.8.0.dev20210124 py3.6_cpu_0 [cpuonly] pytorch-nightly
[conda] torchaudio 0.8.0.dev20210124 py36 pytorch-nightly
[conda] torchvision 0.9.0.dev20210124 py36_cpu [cpuonly] pytorch-nightly
Additional context
I proposed a fix in #3303
Hope this helps!
cc @vfdev-5