pub struct BatchSampler { /* private fields */ }Expand description
Batch sampler for generating batch indices
Implementations§
Source§impl BatchSampler
impl BatchSampler
Sourcepub fn new(dataset_size: usize, config: BatchConfig) -> Self
pub fn new(dataset_size: usize, config: BatchConfig) -> Self
Create new batch sampler
Sourcepub fn next_batch(&mut self) -> Option<Vec<usize>>
pub fn next_batch(&mut self) -> Option<Vec<usize>>
Get next batch of indices
Sourcepub fn num_batches(&self) -> usize
pub fn num_batches(&self) -> usize
Get total number of batches
Sourcepub fn current_batch_index(&self) -> usize
pub fn current_batch_index(&self) -> usize
Get current batch index
Auto Trait Implementations§
impl Freeze for BatchSampler
impl RefUnwindSafe for BatchSampler
impl Send for BatchSampler
impl Sync for BatchSampler
impl Unpin for BatchSampler
impl UnsafeUnpin for BatchSampler
impl UnwindSafe for BatchSampler
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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