pub struct DataLoader<D>{ /* private fields */ }Expand description
DataLoader for batched iteration over datasets.
Provides configurable batching, shuffling, and iteration over datasets.
Implementations§
Source§impl<D> DataLoader<D>
impl<D> DataLoader<D>
Sourcepub fn new(dataset: D, batch_size: usize) -> Self
pub fn new(dataset: D, batch_size: usize) -> Self
Creates a new DataLoader with the specified batch size.
Sourcepub fn drop_last(self, drop_last: bool) -> Self
pub fn drop_last(self, drop_last: bool) -> Self
Sets whether to drop the last incomplete batch.
Sourcepub fn num_workers(self, num_workers: usize) -> Self
pub fn num_workers(self, num_workers: usize) -> Self
Sets the number of worker threads for parallel data loading.
Sourcepub fn batch_size(&self) -> usize
pub fn batch_size(&self) -> usize
Returns the batch size.
Sourcepub fn dataset_len(&self) -> usize
pub fn dataset_len(&self) -> usize
Returns the dataset length.
Sourcepub fn iter(&self) -> DataLoaderIter<'_, D> ⓘ
pub fn iter(&self) -> DataLoaderIter<'_, D> ⓘ
Creates an iterator over batches.
Auto Trait Implementations§
impl<D> Freeze for DataLoader<D>where
D: Freeze,
impl<D> RefUnwindSafe for DataLoader<D>where
D: RefUnwindSafe,
impl<D> Send for DataLoader<D>
impl<D> Sync for DataLoader<D>
impl<D> Unpin for DataLoader<D>where
D: Unpin,
impl<D> UnwindSafe for DataLoader<D>where
D: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more