delu.data.IndexLoader.__init__#
- IndexLoader.__init__(size, *args, device='cpu', **kwargs)[source]#
Initialize self.
- Parameters:
size (int) – the number of items (for example,
len(dataset)
)*args – positional arguments for
torch.utils.data.DataLoader
device (int | str | device) – if not CPU, then all indices are materialized and moved to the device at the beginning of every loop. It can be useful when the indices are applied to non-CPU data (e.g. CUDA-tensors) and moving data between devices takes non-negligible time (which can happen in the case of simple and fast models like MLPs).
**kwargs – keyword arguments for
torch.utils.data.DataLoader
- Raises:
AssertionError – if size is not positive
- Return type:
None