def loss(self, trg_batch, train): losses = [] for i in range(len(trg_batch)-1): y = self.decode_step(trg_batch[i], train) loss = F.softmax_cross_entropy(y, trg_batch[i+1], 0) losses.append(loss) return F.batch.mean(F.sum(losses))
def loss(self, trg_batch, train): """Calculates loss values.""" losses = [] for i in range(len(trg_batch) - 1): y = self.decode_step(trg_batch[i], train) losses.append(F.softmax_cross_entropy(y, trg_batch[i + 1], 0)) return F.batch.mean(F.sum(losses))
def loss(self, outputs, inputs): losses = [ F.softmax_cross_entropy(outputs[i], inputs[i + 1], 0) for i in range(len(outputs)) ] return F.batch.mean(F.sum(losses))