DataLoader

class lightkit.data.DataLoader(dataset, **kwargs)[source]

Bases: torch.utils.data.dataloader.DataLoader[lightkit.data.loader.T_co]

Extension for PyTorch's builtin dataloader. This implementation allows to retrieve contiguous indices from a TensorDataset orders of magnitude faster. The data loader, thus, enables to implement traditional machine learning methods that exhibit a speed similar to the implementations found in Scikit-learn.

Note

Retrieving contiguous indices is only possible when all of the following conditions apply:

  • shuffle=False or batch_sampler is of type RangeBatchSampler

  • sampler is None

  • num_workers=0

  • dataset is not iterable

Parameters
  • dataset (Dataset[TypeVar(T_co, covariant=True)]) -- The dataset from which to load the data.

  • kwargs (Any) -- Keyword arguments passed to torch.utils.data.DataLoader.__init__().