module 'torch.nn' has no attribute 'ReLu'
时间: 2023-06-21 17:20:52 浏览: 321
PyTorch里面的torch.nn.Parameter()详解
3星 · 编辑精心推荐
The correct spelling for the activation function is `ReLU` (capitalized). Therefore, the correct attribute name in PyTorch is `ReLU` with a capital "L". You can use it like this:
```python
import torch.nn as nn
relu = nn.ReLU()
```
This will create an instance of the `ReLU` activation function that you can use in your neural network.
阅读全文