You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ python -c "import torch; from torchvision import transforms; torch.jit.script(transforms.Resize(256))"
Observe not OK with following:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Users/erip/miniconda3/envs/img/lib/python3.7/site-packages/torch/jit/_script.py", line 943, in script
obj, torch.jit._recursive.infer_methods_to_compile
File "/Users/erip/miniconda3/envs/img/lib/python3.7/site-packages/torch/jit/_recursive.py", line 391, in create_script_module
return create_script_module_impl(nn_module, concrete_type, stubs_fn)
File "/Users/erip/miniconda3/envs/img/lib/python3.7/site-packages/torch/jit/_recursive.py", line 452, in create_script_module_impl
create_methods_and_properties_from_stubs(concrete_type, method_stubs, property_stubs)
File "/Users/erip/miniconda3/envs/img/lib/python3.7/site-packages/torch/jit/_recursive.py", line 335, in create_methods_and_properties_from_stubs
concrete_type._create_methods_and_properties(property_defs, property_rcbs, method_defs, method_rcbs, method_defaults)
RuntimeError:
resize(Tensor img, int[] size, Enum<__torch__.torchvision.transforms.functional.InterpolationMode> interpolation=Enum<InterpolationMode.BILINEAR>) -> (Tensor):
Expected a value of type 'List[int]' for argument 'size' but instead found type 'int'.
:
File "/Users/erip/miniconda3/envs/img/lib/python3.7/site-packages/torchvision/transforms/transforms.py", line 273
PIL Image or Tensor: Rescaled image.
"""
return F.resize(img, self.size, self.interpolation)
~~~~~~~~ <--- HERE
Expected behavior
transforms.Resize should be scriptable in both cases.
Environment
PyTorch version: 1.8.0
Is debug build: False
CUDA used to build PyTorch: None
ROCM used to build PyTorch: N/A
OS: macOS 11.2.3 (x86_64)
GCC version: Could not collect
Clang version: 12.0.0 (clang-1200.0.32.29)
CMake version: version 3.14.0
Python version: 3.7 (64-bit runtime)
Is CUDA available: False
CUDA runtime version: No CUDA
GPU models and configuration: No CUDA
Nvidia driver version: No CUDA
cuDNN version: No CUDA
HIP runtime version: N/A
MIOpen runtime version: N/A
🐛 Bug
Scripting
transforms.Resize
with a single int argument fails while scripting with an iterable argument succeeds.To Reproduce
Steps to reproduce the behavior:
$ python -c "import torch; from torchvision import transforms; torch.jit.script(transforms.Resize((256, 256)))"
$ python -c "import torch; from torchvision import transforms; torch.jit.script(transforms.Resize(256))"
Expected behavior
transforms.Resize
should be scriptable in both cases.Environment
PyTorch version: 1.8.0
Is debug build: False
CUDA used to build PyTorch: None
ROCM used to build PyTorch: N/A
OS: macOS 11.2.3 (x86_64)
GCC version: Could not collect
Clang version: 12.0.0 (clang-1200.0.32.29)
CMake version: version 3.14.0
Python version: 3.7 (64-bit runtime)
Is CUDA available: False
CUDA runtime version: No CUDA
GPU models and configuration: No CUDA
Nvidia driver version: No CUDA
cuDNN version: No CUDA
HIP runtime version: N/A
MIOpen runtime version: N/A
Versions of relevant libraries:
[pip3] numpy==1.20.2
[pip3] torch==1.8.0
[pip3] torchvision==0.9.0a0
[conda] libblas 3.9.0 8_mkl
[conda] libcblas 3.9.0 8_mkl
[conda] liblapack 3.9.0 8_mkl
[conda] mkl 2020.4 h08c4f10_301
[conda] numpy 1.20.2 py37h84c02c4_0
[conda] pytorch 1.8.0 cpu_py37hb93c03e_0
[conda] torchvision 0.9.0 py37h561b37a_0_cpu
Additional context
The text was updated successfully, but these errors were encountered: