PrefetchDataLoader<TBatch>
Models & Types · AiDotNet.Data.Loaders
Wraps a batch-producing function with asynchronous prefetching for pipelined data loading.
Implements: IDisposable
How It Works
Prefetching overlaps data loading with model computation by preparing the next N batches in advance on a background thread. This hides I/O latency and keeps the GPU busy.
Constructors
| Constructor | Summary |
|---|---|
PrefetchDataLoader(PrefetchDataLoaderOptions options) |
Creates a new prefetch data loader. |
Properties
| Property | Summary |
|---|---|
int BufferedCount { get; } |
Gets the number of batches currently buffered. |
Methods
| Method | Summary |
|---|---|
IEnumerable<TBatch> Prefetch(IEnumerable<TBatch> batchProducer) |
Starts prefetching batches from the provided source. |
void Dispose() |
|
void Stop() |
Stops prefetching and cleans up resources. |