7633129ba8d5f0e28bd6b6d6027b14352482ef31,fairseq/data/token_block_dataset.py,TokenBlockDataset,prefetch,#TokenBlockDataset#Any#,104
Before Change
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]
self.dataset.read_into(s, self.cache[start:start + e - s])
self.cache_index[idx] = (start, start + e - s)
start += e - s
@property
def supports_prefetch(self):
return True
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)
})

In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 5
Instances
Project Name: elbayadm/attn2d
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: MaybeShewill-CV/CRNN_Tensorflow
Commit Name: 88b164b98c209ea8e2afbfae93a01b9aacd8b0ab
Time: 2018-09-28
Author: debenito@unternehmertum.de
File Name: tools/train_shadownet.py
Class Name:
Method Name: train_shadownet