pub struct DataLoader<D: Dataset> { /* private fields */ }Expand description
DataLoader for efficient batch loading
Implementations§
Source§impl<D: Dataset> DataLoader<D>
impl<D: Dataset> DataLoader<D>
pub fn new(dataset: D, batch_size: usize) -> Self
pub fn shuffle(self, shuffle: bool) -> Self
pub fn drop_last(self, drop_last: bool) -> Self
pub fn num_workers(self, num_workers: usize) -> Self
pub fn is_empty(&self) -> bool
Sourcepub fn iter(&self) -> DataLoaderIter<'_, D> ⓘ
pub fn iter(&self) -> DataLoaderIter<'_, D> ⓘ
Create 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