The dataset base class#
Base class for all datasets.
Classes#
|
Baseclass for tpcp Dataset objects. |
Provide common behavior for datasets that wrap another dataset. |
Wrapping datasets#
DatasetWrapperMixin contains the common implementation for datasets that wrap another dataset while
preserving a shared domain-specific dataset interface. It expands the wrapped index, derives the wrapper’s initial
grouping, and resolves the wrapped datapoint represented by each wrapper datapoint.
Because the mixin does not inherit from Dataset, wrapper classes combine it with their domain-specific
dataset base:
class AugmentedImageDataset(
DatasetWrapperMixin[ImageDataset],
ImageDataset,
):
...
Important
The inheritance order is required. DatasetWrapperMixin must be the first base and the domain-specific dataset
must be the second base. Reversing them changes Python’s method resolution order, preventing the mixin’s
create_index implementation from taking precedence. TPCP raises a TypeError when it detects the reversed
order.