delu.data.Enumerate#
- class delu.data.Enumerate(dataset)[source]#
Make dataset return both indices and items.
Tutorial
from torch.utils.data import DataLoader, TensorDataset X, y = torch.randn(9, 2), torch.randn(9) dataset = TensorDataset(X, y) for batch_idx, batch in DataLoader(delu.data.Enumerate(dataset), batch_size=3): print(batch_idx)
tensor([0, 1, 2]) tensor([3, 4, 5]) tensor([6, 7, 8])
Attributes
Access the underlying dataset.
Methods
Initialize self.
Return index and the corresponding item from the underlying dataset.
Get the length of the underlying dataset.