2a1a6851344172e0134f3c5f4f5c1021975f2812,torchnlp/samplers/bucket_batch_sampler.py,BucketBatchSampler,__iter__,#BucketBatchSampler#,37

Before Change


            batch_size, drop_last)

    def __iter__(self):
        batches = list(super().__iter__())
        if self.last_batch_first:
            last_batch = batches.pop()
        if self.shuffle:
            random.shuffle(batches)
        if self.last_batch_first:
            batches.insert(0, last_batch)

After Change


                range(len(batches)),
                key=lambda i: len(pickle.dumps([self.data[j] for j in batches[i]])))
            front = [batches[i] for i in indices]
            for i in sorted(indices, reverse=True):
                batches.pop(i)
            batches[0:0] = front
            return iter(batches)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: PetrochukM/PyTorch-NLP
Commit Name: 2a1a6851344172e0134f3c5f4f5c1021975f2812
Time: 2018-03-11
Author: petrochukm@gmail.com
File Name: torchnlp/samplers/bucket_batch_sampler.py
Class Name: BucketBatchSampler
Method Name: __iter__


Project Name: ClimbsRocks/auto_ml
Commit Name: 9b9e491bb00be66b732d2f44b3e4375206940e61
Time: 2016-10-19
Author: climbsbytes@gmail.com
File Name: auto_ml/predictor.py
Class Name: Predictor
Method Name: make_sub_x_and_y_test


Project Name: keras-team/keras
Commit Name: 57612707c1434ed3b18f9cad5cf2e6dd8b7b3b7d
Time: 2015-11-02
Author: roller@cs.utexas.edu
File Name: keras/layers/core.py
Class Name: Merge
Method Name: __init__