module 'torch.nn' has no attribute 'Relu'
时间: 2023-09-27 08:04:07 浏览: 184
在PyTorch中,出现"module 'torch.nn' has no attribute 'Relu'"的错误是因为你使用了错误的函数名称。正确的函数名称应该是"nn.ReLU"而不是"nn.Relu"。
你可以通过将"nn.Relu"改为"nn.ReLU"来解决这个问题。 <span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *3* [Pytorch学习遇到的问题](https://blog.csdn.net/App__ppA/article/details/125823126)[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_1"}}] [.reference_item style="max-width: 50%"]
- *2* [AttributeError: module ‘torch.nn‘ has no attribute ‘SiLU‘问题的解决办法](https://blog.csdn.net/ggggod_lei/article/details/128266993)[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_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文