b1521f962e4ca670311c0cd0c8b1dadf310cb242,tests/test_noising.py,TestDataNoising,test_word_shuffle_without_eos,#TestDataNoising#,231
Before Change
Same result as word shuffle with eos except no EOS at end
vocab, x, x_len = self._get_test_data(append_eos=False)
with data_utils.numpy_seed(1234):
word_shuffle = noising.WordShuffle(vocab)
x_noised, l_noised = word_shuffle.noising(x, x_len, 0)
self.assert_no_shuffle_with_0_distance(
x=x, x_noised=x_noised, x_len=x_len, l_noised=l_noised
)
self.assert_no_eos_at_end(x=x_noised, x_len=l_noised, eos=vocab.eos())
x_noised, l_noised = word_shuffle.noising(x, x_len, 3)
self.assert_word_shuffle_with_distance_3(
x=x, x_noised=x_noised, x_len=x_len, l_noised=l_noised
)
self.assert_no_eos_at_end(x=x_noised, x_len=l_noised, eos=vocab.eos())
def _get_noising_dataset_batch(
self, src_tokens_no_pad, src_dict, use_append_eos_dataset=False
):
After Change
// Assert word shuffle with max shuffle distance 0 causes input to be
// unchanged
self.assert_word_shuffle_matches_expected(
x=x,
x_len=x_len,
max_shuffle_distance=0,
vocab=vocab,
expected_shufle_maps=[
self.generate_unchanged_shuffle_map(example_len)
for example_len in x_len
],
expect_eos_at_end=False,
)
// Assert word shuffle with max shuffle distance 3 matches our expected
// shuffle order
self.assert_word_shuffle_matches_expected(
In pattern: SUPERPATTERN
Frequency: 6
Non-data size: 19
Instances
Project Name: pytorch/fairseq
Commit Name: b1521f962e4ca670311c0cd0c8b1dadf310cb242
Time: 2018-11-01
Author: lie@fb.com
File Name: tests/test_noising.py
Class Name: TestDataNoising
Method Name: test_word_shuffle_without_eos
Project Name: elbayadm/attn2d
Commit Name: b1521f962e4ca670311c0cd0c8b1dadf310cb242
Time: 2018-11-01
Author: lie@fb.com
File Name: tests/test_noising.py
Class Name: TestDataNoising
Method Name: test_word_shuffle_with_eos
Project Name: elbayadm/attn2d
Commit Name: b1521f962e4ca670311c0cd0c8b1dadf310cb242
Time: 2018-11-01
Author: lie@fb.com
File Name: tests/test_noising.py
Class Name: TestDataNoising
Method Name: test_word_shuffle_without_eos
Project Name: elbayadm/attn2d
Commit Name: b1521f962e4ca670311c0cd0c8b1dadf310cb242
Time: 2018-11-01
Author: lie@fb.com
File Name: tests/test_noising.py
Class Name: TestDataNoising
Method Name: test_word_shuffle_with_eos_nonbpe