解决 'AttributeError: module 'torchvision.transforms' has no attribute 'Scale'' 错误
The error message 'AttributeError: module 'torchvision.transforms' has no attribute 'Scale'' indicates that the Scale method is not available in the transforms module. This is because the Scale class was deprecated in torchvision version 0.4.0 and replaced with the Resize class.
To fix this error, you should replace transforms.Scale(128) with transforms.Resize(128) in your code.
Here's the updated code:
transform = transforms.Compose([transforms.Resize(128),
# other transformations...
])
Make sure you have the latest version of torchvision installed by running pip install torchvision --upgrade.
原文地址: https://www.cveoy.top/t/topic/qmS1 著作权归作者所有。请勿转载和采集!