0e7bfac76b97e7630102687f7e6309e00e190091,onmt/translate/translator.py,Translator,_score_target,#Translator#Any#Any#Any#Any#Any#,676

Before Change


                                      src_map=src_map)
        tgt_pad = self.fields["tgt"].vocab.stoi[inputters.PAD_WORD]
        for log_prob, tgt in zip(log_probs, batch.tgt[1:]):
            tgt = tgt.unsqueeze(1)
            scores = log_prob.gather(1, tgt)
            scores.masked_fill_(tgt.eq(tgt_pad), 0)
            gold_scores += scores.view(-1)

After Change



        log_probs[:, :, tgt_pad] = 0
        gold = batch.tgt[1:].unsqueeze(2)
        gold_scores = log_probs.gather(2, gold)
        gold_scores = gold_scores.sum(dim=0).view(-1)

        return gold_scores
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 2

Instances


Project Name: OpenNMT/OpenNMT-py
Commit Name: 0e7bfac76b97e7630102687f7e6309e00e190091
Time: 2018-11-13
Author: benzurdopeters@gmail.com
File Name: onmt/translate/translator.py
Class Name: Translator
Method Name: _score_target


Project Name: facebookresearch/Horizon
Commit Name: 247203f29b7e841204c76d922c1ea5b2680c3663
Time: 2020-12-08
Author: czxttkl@fb.com
File Name: reagent/model_utils/seq2slate_utils.py
Class Name:
Method Name: per_symbol_to_per_seq_probs


Project Name: ixaxaar/pytorch-dnc
Commit Name: c9eb3a5ca7cc2f2eeb30219477fbf87bde23e360
Time: 2017-12-09
Author: root@ixaxaar.in
File Name: dnc/sparse_memory.py
Class Name: SparseMemory
Method Name: write