CachedDataset

class torchelie.datasets.CachedDataset(ds, transform=None, device='cpu')

Wrap a dataset. Lazily caches in RAM elements returned by the underlying dataset.

Parameters
  • ds (Dataset) – A dataset

  • transform (Callable) – transform to apply on cached elements

  • device – the device on which the cache is allocated