Realm

oa::data::PrefetchDataLoader

Asynchronous batch iterator over a shared HostDataset. A single worker thread walks the epoch’s index order, calls get_host_sample, collates, and pushes HostBatch values into a queue bounded at prefetch_batches. next_batch pops on the caller thread, so sample production overlaps consumption; next_batch_on additionally uploads the collated batch to the runtime. Shuffle order, drop_last, and epoch resets share the DataLoader seed contract. One worker is the admitted contract: the queue depth already decouples production from consumption, and multi-worker partitioning would add index ownership without changing the device boundary.

StRust public API

Declaration

pub struct PrefetchDataLoader { /* private fields */ }
Public Rust declaration.

Public Methods

pub fn next_batch(&mut self) -> Result<Option<HostBatch>>
pub fn next_batch_on(&mut self, runtime: &Runtime) -> Result<Option<Batch>>
pub fn reset_epoch(&mut self, epoch: u64) -> Result<()>
pub fn num_batches(&self) -> i64

Associated Functions

pub fn new( dataset: Arc<dyn HostDataset>, config: DataLoaderConfig, prefetch_batches: usize, ) -> Result<Self>

Public Method Documentation

pub fn next_batch( &mut self ) -> Result<Option<HostBatch>>
No public source comment is attached to this declaration.
pub fn next_batch_on( &mut self, runtime: &Runtime ) -> Result<Option<Batch>>
No public source comment is attached to this declaration.
pub fn reset_epoch(&mut self, epoch: u64) -> Result<()>
No public source comment is attached to this declaration.
pub fn num_batches( &self ) -> i64
No public source comment is attached to this declaration.
pub fn new( dataset: Arc<dyn HostDataset>, config: DataLoaderConfig, prefetch_batches: usize ) -> Result<Self>
No public source comment is attached to this declaration.