pytorch
a2e81a80 - [DataLoader] `__getitems__` added to description of Dataset API and better supported within `Subset` (#100375)

Commit
1 year ago
[DataLoader] `__getitems__` added to description of Dataset API and better supported within `Subset` (#100375) DataLoader supports batched loading from Mapped Datasets. This is the fetcher's implementation of auto-detection of batch loading support. torch.utils.data._utils.fetch._MapDatasetFetcher ``` class _MapDatasetFetcher(_BaseDatasetFetcher): def fetch(self, possibly_batched_index): if self.auto_collation: if hasattr(self.dataset, "__getitems__") and self.dataset.__getitems__: data = self.dataset.__getitems__(possibly_batched_index) else: data = [self.dataset[idx] for idx in possibly_batched_index] ``` Description of Dataset API now shows this feature. Additionally, Subset dataset now supports `__getitems__` if parent dataset supports it. Pull Request resolved: https://github.com/pytorch/pytorch/pull/100375 Approved by: https://github.com/ejguan, https://github.com/NivekT
Author
Committer
Parents
Loading