dbd4344f433498232ab26da5af3ba142f9accb51,onmt/io/TextDataset.py,TextDataset,collapse_copy_scores,#Any#Any#Any#Any#,92

Before Change


                ti = tgt_vocab.stoi[sw]
                if ti != 0:
                    scores[:, b, ti] += scores[:, b, offset + i]
                    scores[:, b, offset + i].fill_(1e-20)
        return scores

    @staticmethod
    def make_text_examples_nfeats_tpl(path, truncate, side):

After Change


        offset = len(tgt_vocab)
        for b in range(batch.batch_size):
            blank = []
            fill = []
            index = batch.indices.data[b]
            src_vocab = src_vocabs[index]
            for i in range(1, len(src_vocab)):
                sw = src_vocab.itos[i]
                ti = tgt_vocab.stoi[sw]
                if ti != 0:
                    blank.append(offset + i)
                    fill.append(ti)
            blank = torch.LongTensor(blank).cuda()
            fill = torch.LongTensor(fill).cuda()
            scores[:, b].index_add_(1, fill,
                                    scores[:, b].index_select(1, blank))
            scores[:, b].index_fill_(1, blank, 1e-10)
        return scores
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: OpenNMT/OpenNMT-py
Commit Name: dbd4344f433498232ab26da5af3ba142f9accb51
Time: 2018-02-01
Author: s.gehrmann@outlook.com
File Name: onmt/io/TextDataset.py
Class Name: TextDataset
Method Name: collapse_copy_scores


Project Name: OpenNMT/OpenNMT-py
Commit Name: 3a71ecffa3a8aff931a0ff865434e11e8ea08ba3
Time: 2018-10-22
Author: guillaume.klein@systrangroup.com
File Name: onmt/translate/translator.py
Class Name: Translator
Method Name: _fast_translate_batch


Project Name: OpenNMT/OpenNMT-py
Commit Name: 2d47f3f4a1ca342baf92c20a3e1d11c9eb80b3d1
Time: 2016-10-16
Author: alerer@fb.com
File Name: word_language_model/main.py
Class Name: RNNModel
Method Name: __init__