pub struct BatchCollector { /* private fields */ }Expand description
Collects individual samples into batches for efficient processing.
Implementations§
Source§impl BatchCollector
impl BatchCollector
pub fn new(sample_shape: Vec<usize>, max_batch: usize) -> Self
Sourcepub fn push(&mut self, sample: &Tensor) -> Result<(), ModelError>
pub fn push(&mut self, sample: &Tensor) -> Result<(), ModelError>
Adds a sample [...] (must match sample_shape).
Sourcepub fn is_ready(&self) -> bool
pub fn is_ready(&self) -> bool
Returns true if the collector has enough samples for a full batch.
Auto Trait Implementations§
impl Freeze for BatchCollector
impl RefUnwindSafe for BatchCollector
impl Send for BatchCollector
impl Sync for BatchCollector
impl Unpin for BatchCollector
impl UnsafeUnpin for BatchCollector
impl UnwindSafe for BatchCollector
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