[docs]classRawDataLoader:"""A loader object can load samples from storage."""
[docs]defsample(self,sample:typing.Any)->Sample:"""Load whole samples from media. Parameters ---------- sample Information about the sample to load. Implementation dependent. Returns ------- The instantiated sample, which is a dictionary where keys name the sample's data and metadata. """raiseNotImplementedError("You must implement the `sample()` method")
Transform:typing.TypeAlias=typing.Callable[[torch.Tensor],torch.Tensor]"""A callable that transforms tensors into (other) tensors.Typically used in data-processing pipelines inside pytorch."""TransformSequence:typing.TypeAlias=typing.Sequence[Transform]"""A sequence of transforms."""DatabaseSplit:typing.TypeAlias=collections.abc.Mapping[str,typing.Sequence[typing.Any],]"""The definition of a database split.A database split maps dataset (subset) names to sequences of objects that,through a :py:class:`RawDataLoader`, eventually becomes a :py:data:`.Sample` inthe processing pipeline."""ConcatDatabaseSplit:typing.TypeAlias=collections.abc.Mapping[str,typing.Sequence[tuple[typing.Sequence[typing.Any],RawDataLoader]],]"""The definition of a complex database split composed of several other splits.A database split maps dataset (subset) names to sequences of objects that,through a :py:class:`.RawDataLoader`, eventually becomes a :py:data:`.Sample` inthe processing pipeline. Objects of this subtype allow the construction ofcomplex splits composed of cannibalized parts of other splits. Each split maybe assigned a different :py:class:`.RawDataLoader`."""
[docs]classDataset(torch.utils.data.Dataset[Sample],typing.Iterable,typing.Sized):"""Our own definition of a pytorch Dataset. We iterate over Sample objects in this case. Our datasets always provide a dunder len method. """
[docs]deftargets(self)->list[int|list[int]]:"""Return the integer targets for all samples in the dataset."""raiseNotImplementedError("You must implement the `targets()` method")
DataLoader:typing.TypeAlias=torch.utils.data.DataLoader[Sample]"""Our own augmentation definition of a pytorch DataLoader.We iterate over Sample objects in this case."""