7633129ba8d5f0e28bd6b6d6027b14352482ef31,fairseq/data/token_block_dataset.py,TokenBlockDataset,prefetch,#TokenBlockDataset#Any#,104

Before Change


    def prefetch(self, indices):
        indices.sort()
        total_size = 0
        for idx in indices:
            s, e = self.slice_indices[idx]
            total_size += e - s
        self.cache = np.empty(total_size, dtype=np.int32)
        start = 0
        for idx in indices:
            s, e = self.slice_indices[idx]

After Change


        return getattr(self.dataset, "supports_prefetch", False)

    def prefetch(self, indices):
        self.dataset.prefetch({
            ds_idx
            for index in indices
            for start_ds_idx, _, end_ds_idx in [self.block_to_dataset_index[index]]
            for ds_idx in range(start_ds_idx, end_ds_idx + 1)
        })
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 7

Instances


Project Name: pytorch/fairseq
Commit Name: 7633129ba8d5f0e28bd6b6d6027b14352482ef31
Time: 2019-01-04
Author: myleott@fb.com
File Name: fairseq/data/token_block_dataset.py
Class Name: TokenBlockDataset
Method Name: prefetch


Project Name: inspirehep/magpie
Commit Name: b6dafdaf674e09dad523563909bb510935b5f655
Time: 2016-01-08
Author: jan.stypka@cern.ch
File Name: magpie/evaluation/utils.py
Class Name:
Method Name: remove_unguessable_answers


Project Name: pantsbuild/pants
Commit Name: 99c2a50bf0b70732aa6c0aae9b74db0969ff4f6f
Time: 2018-04-05
Author: stuhood@twitter.com
File Name: src/python/pants/engine/legacy/address_mapper.py
Class Name: LegacyAddressMapper
Method Name: scan_build_files