725b3736d006417678097cceabcf7c974cb16ac3,tests/modules/seq2seq_encoders/pytorch_seq2seq_wrapper_test.py,TestPytorchSeq2SeqWrapper,test_forward_pulls_out_correct_tensor_for_unsorted_batches,#TestPytorchSeq2SeqWrapper#,49

Before Change


        tensor[2, 2:, :] = 0
        tensor[3, 6:, :] = 0
        input_tensor = Variable(tensor)
        sequence_lengths = Variable(torch.LongTensor([3, 4, 2, 6, 7]))
        sorted_inputs, sorted_sequence_lengths, restoration_indices = sort_batch_by_length(input_tensor,
                                                                                           sequence_lengths)
        packed_sequence = pack_padded_sequence(sorted_inputs,
                                               sorted_sequence_lengths.data.tolist(),

After Change


        tensor[1, 4:, :] = 0
        tensor[2, 2:, :] = 0
        tensor[3, 6:, :] = 0
        mask = torch.ones(5, 7)
        mask[0, 3:] = 0
        mask[1, 4:] = 0
        mask[2, 2:] = 0
        mask[3, 6:] = 0

        input_tensor = Variable(tensor)
        mask = Variable(mask)
        sequence_lengths = get_lengths_from_binary_sequence_mask(mask)
        sorted_inputs, sorted_sequence_lengths, restoration_indices = sort_batch_by_length(input_tensor,
                                                                                           sequence_lengths)
        packed_sequence = pack_padded_sequence(sorted_inputs,
                                               sorted_sequence_lengths.data.tolist(),
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 22

Instances


Project Name: allenai/allennlp
Commit Name: 725b3736d006417678097cceabcf7c974cb16ac3
Time: 2017-08-29
Author: mattg@allenai.org
File Name: tests/modules/seq2seq_encoders/pytorch_seq2seq_wrapper_test.py
Class Name: TestPytorchSeq2SeqWrapper
Method Name: test_forward_pulls_out_correct_tensor_for_unsorted_batches


Project Name: allenai/allennlp
Commit Name: 725b3736d006417678097cceabcf7c974cb16ac3
Time: 2017-08-29
Author: mattg@allenai.org
File Name: tests/modules/seq2vec_encoders/pytorch_seq2vec_wrapper_test.py
Class Name: TestPytorchSeq2VecWrapper
Method Name: test_forward_pulls_out_correct_tensor_with_sequence_lengths


Project Name: allenai/allennlp
Commit Name: 725b3736d006417678097cceabcf7c974cb16ac3
Time: 2017-08-29
Author: mattg@allenai.org
File Name: tests/modules/seq2vec_encoders/pytorch_seq2vec_wrapper_test.py
Class Name: TestPytorchSeq2VecWrapper
Method Name: test_forward_pulls_out_correct_tensor_with_unsorted_batches


Project Name: allenai/allennlp
Commit Name: 725b3736d006417678097cceabcf7c974cb16ac3
Time: 2017-08-29
Author: mattg@allenai.org
File Name: tests/modules/seq2seq_encoders/pytorch_seq2seq_wrapper_test.py
Class Name: TestPytorchSeq2SeqWrapper
Method Name: test_forward_pulls_out_correct_tensor_with_sequence_lengths