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)
After Change
return get_batches()
else:
batches = list(get_batches())
indices = heapq.nlargest(
5,
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)
In pattern: SUPERPATTERN
Frequency: 10
Non-data size: 6
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: NifTK/NiftyNet
Commit Name: 1f5bd7028636e6320079fc785c4aca9eda51defa
Time: 2019-01-31
Author: wenqi.li@ucl.ac.uk
File Name: niftynet/utilities/util_common.py
Class Name:
Method Name: average_multi_opt_gradients
Project Name: deepmipt/DeepPavlov
Commit Name: 349cfbdebfb05d2faf51ae7c82eca81c97ed5c49
Time: 2019-09-06
Author: mary.vikhreva@gmail.com
File Name: deeppavlov/download.py
Class Name:
Method Name: download_resource
Project Name: dmlc/gluon-nlp
Commit Name: f9be6cd2c3780b3c7e11a1aca189bf8129bc0c0d
Time: 2018-08-03
Author: leonard@lausen.nl
File Name: scripts/word_embeddings/evaluate_pretrained.py
Class Name:
Method Name: load_embedding_from_path
Project Name: Hironsan/anago
Commit Name: 00aab86f24ae60c12325a8e3dbbcb54d25dc4987
Time: 2018-03-06
Author: hiroki.nakayama.py@gmail.com
File Name: anago/preprocess.py
Class Name: StaticPreprocessor
Method Name: transform
Project Name: deepmipt/DeepPavlov
Commit Name: d771d58a66c57aa77b8ef61501bf879de25c0c8c
Time: 2018-05-24
Author: puleon@mail.ru
File Name: deeppavlov/dataset_iterators/ranking_iterator.py
Class Name: RankingIterator
Method Name: gen_batches
Project Name: dmlc/gluon-nlp
Commit Name: bb82889e5cc39ef7a9e7fefdfb7b51fe8c605cf9
Time: 2018-09-28
Author: szhengac@users.noreply.github.com
File Name: scripts/nmt/bleu.py
Class Name:
Method Name: compute_bleu
Project Name: microsoft/nni
Commit Name: 5461fe7792ce43c3a7009a602c086842fe9fae64
Time: 2018-12-20
Author: 871886504@qq.com
File Name: tools/nni_annotation/search_space_generator.py
Class Name: SearchSpaceGenerator
Method Name: visit_Call
Project Name: uber/ludwig
Commit Name: 690e6c8f9a42cf5b42dc010dfb073e54175da221
Time: 2020-05-07
Author: jimthompson5802@gmail.com
File Name: ludwig/models/modules/combiners.py
Class Name: ConcatCombiner
Method Name: call
Project Name: NifTK/NiftyNet
Commit Name: 14f7fd88d24cf31a466726fc89060a4b7778e2e6
Time: 2017-09-04
Author: wenqi.li@ucl.ac.uk
File Name: niftynet/engine/image_window.py
Class Name: ImageWindow
Method Name: set_spatial_shape