spro / practical-pytorch

Go to https://github.com/pytorch/tutorials - this repo is deprecated and no longer maintained
MIT License
4.52k stars 1.11k forks source link

About seq2seq-translation-batched.py RuntimeError #148

Open xiangningOvo opened 3 years ago

xiangningOvo commented 3 years ago

there was error occured:

in score(self, hidden, encoder_output)
     35         elif self.method == 'general':
     36             energy = self.attn(encoder_output)
---> 37             energy = hidden.dot(energy)
     38             return energy
     39 

RuntimeError: 1D tensors expected, but got 2D and 2D tensors

I modify nothing. Can anyone help me!?Thank you

SANTOSHMAHER commented 3 years ago

Hi, Do one thing you can reshape you data then try.

On Mon, 23 Nov, 2020, 15:15 相宁, notifications@github.com wrote:

there was error occured:

in score(self, hidden, encoder_output) 35 elif self.method == 'general': 36 energy = self.attn(encoder_output) ---> 37 energy = hidden.dot(energy) 38 return energy 39

RuntimeError: 1D tensors expected, but got 2D and 2D tensors

I modify nothing. Can anyone help me!?Thank you

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/spro/practical-pytorch/issues/148, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE7HSYT7GPB77QQ74KXOLXLSRIVLRANCNFSM4T7HZG4A .