报错:AttributeError: module ‘torch.nn‘ has no attribute ‘GELU‘

问题:

运行程序报错:

AttributeError: module 'torch.nn' has no attribute 'GELU'

方法:

import torch.nn.functional as F

把nn.RELU改为F.gelu

 

参考:

https://www.cnblogs.com/owlowl/p/13293391.html

你可能感兴趣的:(bug大集合,深度学习,python,pytorch)