0816c636b7d7832a0177a08a08888840d717bed4,theanolm/scoring/textscorer.py,TextScorer,score_batch,#TextScorer#Any#Any#Any#Any#,113

Before Change


            // were words. Add None in place of any ignored <unk>"s.
            if self._ignore_unk:
                seq_word_ids = word_ids[:, seq_index]
                logprob_iter = iter(seq_logprobs)
                seq_logprobs = [None if word_id == self._unk_id
                                else next(logprob_iter)
                                for word_id in seq_word_ids[1:]]
            result.append(seq_logprobs)

After Change


            seq_logprobs = logprobs[seq_mask == 1, seq_index]
            // The new mask also masks excluded tokens, replace those with None.
            seq_mask = new_mask[seq_mask == 1, seq_index]
            seq_logprobs = [lp if m == 1 else None
                            for lp, m in zip(seq_logprobs, seq_mask)]
            result.append(seq_logprobs)

        return result
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: senarvi/theanolm
Commit Name: 0816c636b7d7832a0177a08a08888840d717bed4
Time: 2017-01-24
Author: seppo.git@marjaniemi.com
File Name: theanolm/scoring/textscorer.py
Class Name: TextScorer
Method Name: score_batch


Project Name: calico/basenji
Commit Name: 3f6ab070403224778e180fd755bdfef658c7887d
Time: 2019-11-12
Author: drk@calicolabs.com
File Name: basenji/trainer.py
Class Name: Trainer
Method Name: fit2


Project Name: PetrochukM/PyTorch-NLP
Commit Name: dd2eaf6c174fdd757514bc06d1063e5f9c6bb4a0
Time: 2019-10-20
Author: petrochukm@gmail.com
File Name: torchnlp/samplers/noisy_sorted_sampler.py
Class Name: NoisySortedSampler
Method Name: __iter__