Can't get attribute 'SiLU' on <module 'torch.nn.

使用jupyter调用yoloV5的detect.py程序时,报错如下:

Can't get attribute 'SiLU' on <module 'torch.nn.modules.activation' from '
/usr/local/lib/python3.6/dist-packages/torch/nn/modules/activation.py'>

一找不到正确的解决方法,网上相关的博客很少很少,能找到的方法都试过,没能解决

哪位大佬能给点指导呀

在activation 最下面添加如下代码 或者升级torch 注意Module前面没有nn

class SiLU(Module):#export-friendly version of nn.SiLU()
@staticmethod
def forward(x):
return x * torch.sigmoid(x)

看看这里兄弟https://blog.csdn.net/jacke121/article/details/115047893