IDataLoader<TInput, TOutput>
Interfaces · AiDotNet.Interfaces
Data loader parameterized by both input and output tensor types — the type-theoretic fit
for domains where the batch shape is richer than the row-scalar (X, y) supervised pair
(image-space photometric NeRF training, video / audio / sequence corpora, RL trajectories).
Added as part of #1834 without renaming the existing IDataLoader so
currently-shipped loaders (matrix-in / vector-out supervised) migrate at their own pace.
Implements: ICountable, IResettable
How It Works
Reference PyTorch DataLoader is generic over its collate output type; this
interface expresses the same idea in C# nominal-typing terms. Facade branches on the
concrete TInput / TOutput pair via is checks — an image loader is a
IDataLoader<ImageView<T>, PixelBatch<T>>, and the model layer sees exactly
that shape.
The original IDataLoader continues to be the base for row-scalar supervised
loaders and the specialized IGraphDataLoader / IRLDataLoader / IEpisodicDataLoader
hierarchies — no breakage, no rename. When a full migration is done, IDataLoader
can be re-expressed as IDataLoader<Matrix<T>, Vector<T>>.
Properties
| Property | Summary |
|---|---|
bool IsLoaded { get; } |
Whether the underlying data has been fetched into memory and is ready to iterate. |
string Description { get; } |
Description of the dataset and its intended use. |
string Name { get; } |
Human-readable name of this loader. |
Methods
| Method | Summary |
|---|---|
IEnumerable<ValueTuple<TInput, TOutput>> IterateBatches(int batchSize) |
Enumerates the loaded dataset one batch at a time. |
Task LoadAsync(CancellationToken cancellationToken) |
Loads the dataset (file read, network fetch, preprocessing) asynchronously. |
void Unload() |
Releases the loaded dataset from memory. |