TransformedDataLoader<T>
Models & Types · AiDotNet.Data.Loaders
Wraps a data loader and applies a composable transform pipeline to feature data during batch extraction.
Inheritance: DataLoaderBase<T> → TransformedDataLoader<T>
Implements: IInputOutputDataLoader<T, Tensor<T>, Tensor<T>>
For Beginners
Use this to add normalization, scaling, or other preprocessing to any existing data loader without modifying the original loader:
How It Works
This wrapper applies an ITransform to every sample’s feature
data when batches are retrieved. The underlying loader’s data remains unmodified.
Constructors
| Constructor | Summary |
|---|---|
TransformedDataLoader(InputOutputDataLoaderBase<T, Tensor<T>, Tensor<T>> inner, ITransform<T[], T[]> transform) |
Creates a transformed data loader wrapping the given inner loader. |
Properties
| Property | Summary |
|---|---|
Tensor<T> Features { get; } |
|
Tensor<T> Labels { get; } |
|
bool HasNext { get; } |
|
bool IsShuffled { get; } |
|
int FeatureCount { get; } |
|
int OutputDimension { get; } |
|
int TotalCount { get; } |
|
string Description { get; } |
|
string Name { get; } |
Methods
| Method | Summary |
|---|---|
IAsyncEnumerable<ValueTuple<Tensor<T>, Tensor<T>>> GetBatchesAsync(int? batchSize, bool shuffle, bool dropLast, int? seed, int prefetchCount, CancellationToken cancellationToken) |
|
IEnumerable<ValueTuple<Tensor<T>, Tensor<T>>> GetBatches(int? batchSize, bool shuffle, bool dropLast, int? seed) |
|
ValueTuple<IInputOutputDataLoader<T, Tensor<T>, Tensor<T>>, IInputOutputDataLoader<T, Tensor<T>, Tensor<T>>, IInputOutputDataLoader<T, Tensor<T>, Tensor<T>>> Split(double trainRatio, double validationRatio, int? seed) |
|
ValueTuple<Tensor<T>, Tensor<T>> GetNextBatch() |
|
bool TryGetNextBatch(ValueTuple<Tensor<T>, Tensor<T>> batch) |
|
void Shuffle(int? seed) |
|
void Unshuffle() |