AttributeError: module 'torchvision' has no attribute 'dataset'
时间: 2023-09-24 20:03:39 浏览: 245
导入FashionMNIST数据集时报错module ‘torchvision.datasets’ has no attribute ‘FashionMNIS’
在你的报错信息中,出现了 "AttributeError: module 'torchvision' has no attribute 'dataset'" 这个错误。这个错误是因为在torchvision模块中找不到名为'dataset'的属性。这可能是因为你使用的torchvision的版本较旧,而你的代码是基于新版本编写的。
解决这个问题的方法是更新你的torchvision库。你可以通过使用以下命令来更新torchvision库:
```python
pip install --upgrade torchvision
```
更新完成后,再次运行你的代码应该就不会出现这个错误了。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [AttributeError: module ‘torchvision.models‘ has no attribute ‘xxxx‘ 问题和解决](https://blog.csdn.net/Davidietop/article/details/122296013)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
- *2* *3* [Ubutun20.04 Pycharm pytoch AttributeError: module ‘torchvision.transforms‘ has no attribute ...](https://blog.csdn.net/qq_40721108/article/details/129193347)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文