datasets

BatchesMixin

class BatchesMixin

mixin for supporting batches and collate method from datasets.

collate(batch)
batches(batch_size=32, shuffle=False, drop_last=False, num_workers=0, **kwargs)

return a Dataloader that iterates over batches of this dataset.

Note

this method supports additional keyword args which will be passed to the dataloader.

Parameters
  • batch_size (int) – Defaults to 32.

  • shuffle (bool) – if True shuffle the dataset. Defaults to False.

  • drop_last (bool) – if true drop the last batch if it is less than batch size. Defaults to False.

  • num_workers (int) – number of workers. Defaults to 0.

Return type

DataLoader


TensorDataset

class TensorDataset(*tensors)
tensors: Tuple[torch.Tensor, ...]

XYDataset

class XYDataset(x, y)

basic dataset that returns a tuple of inputs and targets.

supports hearth.containers.TensorDataset

x: Union[Sized, hearth.containers.TensorDict]
y: Union[Sized, hearth.containers.TensorDict]