module 'torchvision.transforms' has no attribute 'Scale' (fix)
AttributeError: module 'torchvision.transforms' has no attribute 'Scale' comes from code written for torchvision 0.11 or older. We ran it on 0.11.3 and 0.24.0; the fix is a one-word rename to Resize.
1. The error
import torchvision
import torchvision.transforms as T
print("torchvision", torchvision.__version__)
t = T.Scale(32)
print(t)
torchvision 0.24.0 (torch 2.9.0):
torchvision 0.24.0+cpu
Traceback (most recent call last):
File "b1.py", line 4, in <module>
t = T.Scale(32)
^^^^^^^
AttributeError: module 'torchvision.transforms' has no attribute 'Scale'
torchvision 0.11.3 (torch 1.10.2):
.../site-packages/torch/torch_version.py:3: UserWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html. The pkg_resources package is slated for removal as early as 2025-11-30. Refrain from using this package or pin to Setuptools<81.
from pkg_resources import packaging # type: ignore[attr-defined]
torchvision 0.11.3+cpu
.../site-packages/torchvision/transforms/transforms.py:317: UserWarning: The use of the transforms.Scale transform is deprecated, please use transforms.Resize instead.
warnings.warn("The use of the transforms.Scale transform is deprecated, " +
Scale(size=32, interpolation=bilinear, max_size=None, antialias=None)
Scale was the old name of Resize. In 0.11.3 it is still a subclass of Resize that only adds the deprecation warning; the next release, 0.12.0, removed it (we checked both wheels). So any code or tutorial written for torchvision 0.11 or older breaks on current versions.
2. Fix: use Resize
import torchvision
import torchvision.transforms as T
print("torchvision", torchvision.__version__)
t = T.Resize(32)
print(t)
torchvision 0.24.0:
torchvision 0.24.0+cpu
Resize(size=32, interpolation=bilinear, max_size=None, antialias=True)
torchvision 0.11.3:
.../site-packages/torch/torch_version.py:3: UserWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html. The pkg_resources package is slated for removal as early as 2025-11-30. Refrain from using this package or pin to Setuptools<81.
from pkg_resources import packaging # type: ignore[attr-defined]
torchvision 0.11.3+cpu
Resize(size=32, interpolation=bilinear, max_size=None, antialias=None)
The arguments are the same (size, then interpolation), so a rename is enough: Scale(32) → Resize(32). One difference: new versions default to antialias=True (shown above), 0.11.3 had None; on tensors that can change pixel values slightly. Pass antialias=False if you need to match old results exactly.
If the call is in a library you can't edit, alias it before the library imports it: import torchvision.transforms as T; T.Scale = T.Resize.
3. If you must run the old torchvision
torchvision 0.11 needs torch 1.10 and Python 3.9 or older. On current Linux, import torch 1.10.2 then fails with cannot enable executable stack as shared object requires (glibc 2.41+); the 0.11.3 output above is after that fix. Porting the code to Resize is far less work.
Related: torchvision.transforms has no attribute v2 · torchvision has no attribute disable_beta_transforms_warning
Frequently asked questions
When was transforms.Scale removed?
torchvision 0.12.0. It was deprecated in favour of Resize before that; 0.11.3 still has it with a warning.
Is Resize exactly the same as Scale?
Same arguments. Newer torchvision defaults to antialias=True, so tensor outputs can differ slightly from old runs; pass antialias=False to match.
Written with AI assistance. Measured on 2026-10-24 on Linux: torchvision 0.24.0+cpu with torch 2.9.0 (CPython 3.11.17) and torchvision 0.11.3+cpu with torch 1.10.2 (CPython 3.9). Output pasted unedited except shortened paths. PlainTables is our extension; torchvision is free.