AttributeError: module 'torch' has no attribute 'Image'
时间: 2023-09-02 18:06:49 浏览: 308
这个错误是因为你在代码中引用了'torch.Image',但是torch模块中没有名为'Image'的属性。据引用所述,这个错误可能与你正在使用的pytorch版本有关。你可以参考引用提供的解决方案,在代码开头添加一段兼容不同版本的代码,以确保新版本函数的输入输出与老版本一样。另外,根据引用,'torch.inference_mode()'函数是在pytorch版本1.9及以上引入的,所以请确保你的pytorch版本在1.9以上。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *3* [AttributeError: module ‘torch‘ has no attribute ‘inference_mode](https://blog.csdn.net/qq_38463737/article/details/123959342)[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^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
- *2* [解决报错:AttributeError: module ‘torch‘ has no attribute ‘irfft](https://blog.csdn.net/jining11/article/details/121503723)[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^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文
相关推荐



















