1b749f4a34d0e4c70cb2f98b8cd32b71b9675fe9,tests/test_sequence_generator.py,TestSequenceGenerator,test_without_normalization,#TestSequenceGenerator#,69

Before Change


    def test_without_normalization(self):
        // Sentence 1: unchanged from the normalized case
        // Sentence 2: beams swap order
        generator = SequenceGenerator(self.tgt_dict, beam_size=2, normalize_scores=False)
        hypos = generator.generate([self.model], self.sample)
        eos, w1, w2 = self.tgt_dict.eos(), self.w1, self.w2
        // sentence 1, beam 1
        self.assertHypoTokens(hypos[0][0], [w1, eos])
        self.assertHypoScore(hypos[0][0], [0.9, 1.0], normalized=False)

After Change


    def test_without_normalization(self):
        // Sentence 1: unchanged from the normalized case
        // Sentence 2: beams swap order
        generator = SequenceGenerator(
            [self.model], self.tgt_dict, beam_size=2, normalize_scores=False
        )
        hypos = generator.forward(self.sample)
        eos, w1, w2 = self.tgt_dict.eos(), self.w1, self.w2
        // sentence 1, beam 1
        self.assertHypoTokens(hypos[0][0], [w1, eos])
        self.assertHypoScore(hypos[0][0], [0.9, 1.0], normalized=False)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 6

Instances


Project Name: pytorch/fairseq
Commit Name: 1b749f4a34d0e4c70cb2f98b8cd32b71b9675fe9
Time: 2020-04-07
Author: chenliu8@fb.com
File Name: tests/test_sequence_generator.py
Class Name: TestSequenceGenerator
Method Name: test_without_normalization


Project Name: elbayadm/attn2d
Commit Name: bc936813485a3af8c3b46de470a2b46e0dc46f83
Time: 2020-04-06
Author: chenliu8@fb.com
File Name: tests/test_sequence_generator.py
Class Name: TestSequenceGenerator
Method Name: test_without_normalization