superAE icon indicating copy to clipboard operation
superAE copied to clipboard

RuntimeError: The size of tensor a (128) must match the size of tensor b (64) at non-singleton dimension 1

Open jufengada opened this issue 5 years ago • 2 comments

/home/TengWei/SAE/models/attention.py:32: UserWarning: Implicit dimension choice for softmax has been deprecated. Change the call to include dim=X as an argument. weights = self.softmax(weights) # batch * time Traceback (most recent call last): File "train.py", line 345, in main() File "train.py", line 334, in main train(i) File "train.py", line 194, in train loss, num_total, num_correct = model.train_model(src, src_len, tgt, tgt_len, opt.loss, updates, optim, num_oovs=num_oovs) File "/home/TengWei/SAE/models/seq2seq.py", line 85, in train_model loss, num_total, num_correct = self.compute_loss(outputs, targets, loss_fn, updates) File "/home/TengWei/SAE/models/seq2seq.py", line 61, in compute_loss return models.cross_entropy_loss(hidden_outputs, self.decoder, targets, self.criterion, self.config) File "/home/TengWei/SAE/models/loss.py", line 190, in cross_entropy_loss num_correct = pred.data.eq(targets.data).masked_select(targets.ne(dict.PAD).data).sum() RuntimeError: The size of tensor a (128) must match the size of tensor b (64) at non-singleton dimension 1

jufengada avatar Oct 04 '19 13:10 jufengada

请问有遇到这个问题吗?

jufengada avatar Oct 04 '19 13:10 jufengada

@jufengada 请问这个问题解决了吗?

berryberrrry avatar Jan 10 '21 05:01 berryberrrry