AttributeError: module ‘torchvision.transforms‘ has no attribute ‘Scale‘

1.问题:

AttributeError: module ‘torchvision.transforms‘ has no attribute 'Scale'

2.参考:

AttributeError: module ‘torchvision.transforms‘ has no attribute ‘Scale‘_Stick_2的博客-CSDN博客

3.解决:

可能因为代码是用torchvision老版本写的,老版本里transforms没有Scale属性。但你现在用torchvision新版本来运行这个代码,然而新版本的torchvision中的transforms没有Scale属性,所以会报错。

在报错的地方的那行代码,把Scale改成Resize就好。

原:

 

改之后:

扫描二维码关注公众号,回复: 17185794 查看本文章

猜你喜欢

转载自blog.csdn.net/weixin_39450145/article/details/125730435
今日推荐