[03464c]: / datasets / dataloader_prefetch.py

Download this file

8 lines (5 with data), 217 Bytes

1
2
3
4
5
6
7
from torch.utils.data import DataLoader
from prefetch_generator import BackgroundGenerator
class DataLoaderPrefetch(DataLoader):
def __iter__(self):
return BackgroundGenerator(super().__iter__())