seq2seq.pytorch icon indicating copy to clipboard operation
seq2seq.pytorch copied to clipboard

module 'torch.nn' has no attribute 'MultiheadAttention'

Open chenQ1114 opened this issue 5 years ago • 1 comments

Hi In the file of modules/attention.py, the class MultiHeadAttention(nn.MultiheadAttention) is reported an error:

class MultiHeadAttention(nn.MultiheadAttention): AttributeError: module 'torch.nn' has no attribute 'MultiheadAttention'

I use the pytorch=0.4.1. Is there any version of torch that containing the nn.MultiheadAttention?

chenQ1114 avatar Jun 18 '19 15:06 chenQ1114

Upgrade to PyTorch 1.3 can solve this problem.

frostinassiky avatar Jul 09 '20 07:07 frostinassiky