AttributeError: module 'torchvision.transforms' has no attribute 'Scale'
时间: 2023-09-27 18:04:02 浏览: 144
AttributeError: module 'tensorflow.compat.v1' has no attribute '
The error message is stating that the attribute 'Scale' does not exist in the module 'torchvision.transforms'. This could be due to a version mismatch or a typo in the code.
In newer versions of PyTorch, the 'Scale' transform has been deprecated and replaced with 'Resize'. To fix the error, you can replace 'Scale' with 'Resize' in your code.
For example, instead of:
```
transforms.Scale(size=(224, 224))
```
You can use:
```
transforms.Resize(size=(224, 224))
```
阅读全文