generic.DataLoader#

class maite.protocols.generic.DataLoader(*args, **kwargs)[source]#

Generic version of a protocol that specifies batch-level access to a data source.

Implementers must provide an iterable object (returning an iterator via the __iter__ method) that yields tuples containing batches of data. These tuples contain types Sequence [InputType], Sequence [TargetType], and Sequence [DatumMetadataType], which correspond to model input batch, model target type batch, and a datum metadata batch.

Note: In practice, this class is specialized within AI-problem specific submodules using structural types for InputType, TargetType, and DatumMetadataType. Implementing this class directly (i.e., without specializing on concrete types) is not recommended. Static type checkers will effectively consider all non-specified type parameters as Any-type, effectively masking potential type incompatibilities.