Struct BatchDataLoader
pub struct BatchDataLoader<B, I, O>where
B: Backend,{ /* private fields */ }Expand description
A data loader that can be used to iterate over a dataset in batches.
Implementations§
§impl<B, I, O> BatchDataLoader<B, I, O>where
B: Backend,
impl<B, I, O> BatchDataLoader<B, I, O>where
B: Backend,
pub fn new(
strategy: Box<dyn BatchStrategy<I>>,
dataset: Arc<dyn Dataset<I>>,
batcher: Arc<dyn Batcher<B, I, O>>,
device: <B as BackendTypes>::Device,
rng: Option<StdRng>,
) -> BatchDataLoader<B, I, O>
pub fn new( strategy: Box<dyn BatchStrategy<I>>, dataset: Arc<dyn Dataset<I>>, batcher: Arc<dyn Batcher<B, I, O>>, device: <B as BackendTypes>::Device, rng: Option<StdRng>, ) -> BatchDataLoader<B, I, O>
Trait Implementations§
§impl<B, I, O> Clone for BatchDataLoader<B, I, O>where
B: Backend,
impl<B, I, O> Clone for BatchDataLoader<B, I, O>where
B: Backend,
§fn clone(&self) -> BatchDataLoader<B, I, O>
fn clone(&self) -> BatchDataLoader<B, I, O>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read more§impl<B, I, O> DataLoader<B, O> for BatchDataLoader<B, I, O>
impl<B, I, O> DataLoader<B, O> for BatchDataLoader<B, I, O>
§fn iter<'a>(&'a self) -> Box<dyn DataLoaderIterator<O, Item = O> + 'a>
fn iter<'a>(&'a self) -> Box<dyn DataLoaderIterator<O, Item = O> + 'a>
Returns a boxed iterator to iterate over the data loader.
§fn num_items(&self) -> usize
fn num_items(&self) -> usize
The number of items (not the number of batches nor the number of iterations),
corresponding to the items_total of the progress returned by the iterator.
§fn to_device(
&self,
device: &<B as BackendTypes>::Device,
) -> Arc<dyn DataLoader<B, O>>
fn to_device( &self, device: &<B as BackendTypes>::Device, ) -> Arc<dyn DataLoader<B, O>>
Move the data loader to the given device, ensuring the batches are assigned to the correct device.
Auto Trait Implementations§
impl<B, I, O> Freeze for BatchDataLoader<B, I, O>
impl<B, I, O> !RefUnwindSafe for BatchDataLoader<B, I, O>
impl<B, I, O> Send for BatchDataLoader<B, I, O>
impl<B, I, O> Sync for BatchDataLoader<B, I, O>
impl<B, I, O> Unpin for BatchDataLoader<B, I, O>
impl<B, I, O> !UnwindSafe for BatchDataLoader<B, I, O>
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
§impl<C> CloneExpand for Cwhere
C: Clone,
impl<C> CloneExpand for Cwhere
C: Clone,
fn __expand_clone_method(&self, _scope: &mut Scope) -> C
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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