switch from deprecated size_average to reduction in seq2seq agent's loss functions
@@ -186,10 +186,10 @@ class Seq2seqAgent(TorchAgent):
# set up criteria
if opt.get('numsoftmax', 1) > 1:
self.criterion = nn.NLLLoss(
- ignore_index=self.NULL_IDX, size_average=False)
+ ignore_index=self.NULL_IDX, reduction='sum')
else:
self.criterion = nn.CrossEntropyLoss(
- ignore_index=self.NULL_IDX, size_average=False)
+ ignore_index=self.NULL_IDX, reduction='sum')
if self.use_cuda:
self.criterion.cuda()
