hengruo / QANet-pytorch

A PyTorch implementation of QANet.
MIT License
344 stars 67 forks source link

some issues #14

Open qjzhzw opened 5 years ago

qjzhzw commented 5 years ago

Hi, @hengruo When I trained the model, I got an issue below:

File "/XXX/QANet-pytorch-master/models.py", line 33, in init self.pos_encoding = nn.Parameter(torch.sin(torch.add(torch.mul(pos, freqs), phases)), requires_grad=False) RuntimeError: Expected object of type torch.LongTensor but found type torch.FloatTensor for argument #2 'other'

Then I modified the code so that I can run it correctly: self.pos_encoding = nn.Parameter(torch.sin(torch.add(torch.mul(pos.float(), freqs), phases)), requires_grad=False)

I don't know why only I have got the issue. Thank you!