Skip to content

Commit

Permalink
fix goldscore OpenNMT#1383 (OpenNMT#1423)
Browse files Browse the repository at this point in the history
* fix OpenNMT#1383

* fix gold score only
  • Loading branch information
vince62s authored May 6, 2019
1 parent 03fe8d9 commit c8c2369
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion onmt/translate/translator.py
Original file line number Diff line number Diff line change
Expand Up @@ -806,7 +806,7 @@ def _score_target(self, batch, memory_bank, src_lengths,
memory_lengths=src_lengths, src_map=src_map)

log_probs[:, :, self._tgt_pad_idx] = 0
gold = tgt_in
gold = tgt[1:]
gold_scores = log_probs.gather(2, gold)
gold_scores = gold_scores.sum(dim=0).view(-1)

Expand Down

0 comments on commit c8c2369

Please sign in to comment.