Transformer
Transformer copied to clipboard
RuntimeError: The size of tensor a (127) must match the size of tensor b (40) at non-singleton dimension 3
if mask is not None:
mask = mask.unsqueeze(1)
scores = scores.masked_fill(mask == 0, -1e9)
scores = F.softmax(scores, dim=-1)
runtime error in scores.masked_fill(mask == 0, -1e9)
Same for this:
x = x + Variable(self.pe[:,:seq_len], requires_grad=False).cuda()
x = x + pe
return self.dropout(x)
Please help