31803d30a9f0c4dde1342678f8fced1d0978c2db,tests/test_torch_agent.py,TestTorchAgent,test_batchify,#TestTorchAgent#,306

Before Change


            self.assertEqual(list(batch.valid_indices), [1, 2, 0])

            // test lambda
            batch = agent.batchify(obs_vecs, is_valid=(
                lambda obs: "text_vec" in obs and len(obs["text_vec"]) < 3))
            self.assertEqual(batch.text_vec.tolist(), [[1, 2]])
            self.assertEqual(batch.text_lengths, [2])
            self.assertEqual(batch.label_vec.tolist(), [[1, 2]])
            self.assertEqual(batch.label_lengths, [2])

After Change


                return "text_vec" in obs and len(obs["text_vec"]) < 3
            agent.is_valid = is_valid

            batch = agent.batchify(obs_vecs)
            self.assertEqual(batch.text_vec.tolist(), [[1, 2]])
            self.assertEqual(batch.text_lengths, [2])
            self.assertEqual(batch.label_vec.tolist(), [[1, 2]])
            self.assertEqual(batch.label_lengths, [2])
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 7

Non-data size: 3

Instances


Project Name: facebookresearch/ParlAI
Commit Name: 31803d30a9f0c4dde1342678f8fced1d0978c2db
Time: 2019-02-27
Author: edinan@fb.com
File Name: tests/test_torch_agent.py
Class Name: TestTorchAgent
Method Name: test_batchify


Project Name: facebookresearch/pytext
Commit Name: a736a6fa2daf5bc086c658acad68cc2af1e94b57
Time: 2019-04-24
Author: mikaell@fb.com
File Name: pytext/data/test/batch_sampler_test.py
Class Name: BatchSamplerTest
Method Name: test_prob_batch_sampler


Project Name: pyannote/pyannote-audio
Commit Name: 7bef7c98663e373c4fae91eb7aeb20e8eb9fca7f
Time: 2017-05-17
Author: bredin@limsi.fr
File Name: pyannote/audio/embedding/approaches/triplet_loss.py
Class Name: TripletLoss
Method Name: _get_batch_generator_y


Project Name: dnouri/skorch
Commit Name: e82c5a5ad0873d0ac8bf824b603f163ee5ac18ef
Time: 2017-07-24
Author: marian.tietz@ottogroup.com
File Name: examples/word_language_model/train.py
Class Name: Loader
Method Name: __init__


Project Name: pyannote/pyannote-audio
Commit Name: 7bef7c98663e373c4fae91eb7aeb20e8eb9fca7f
Time: 2017-05-17
Author: bredin@limsi.fr
File Name: pyannote/audio/embedding/approaches/triplet_loss.py
Class Name: TripletLoss
Method Name: _get_batch_generator_z


Project Name: pyannote/pyannote-audio
Commit Name: a494415343ae6cfe3781a51d978b0876b98adc47
Time: 2018-06-29
Author: bredin@limsi.fr
File Name: pyannote/audio/generators/speaker.py
Class Name: SpeechSegmentGenerator
Method Name: __call__


Project Name: dnouri/skorch
Commit Name: f4969e2ec63686911b6697099e9cf55bfbe1d441
Time: 2017-08-04
Author: marian.tietz@ottogroup.com
File Name: examples/word_language_model/data.py
Class Name: Loader
Method Name: __init__