pub struct AdaptiveBatchSizer { /* private fields */ }Expand description
Adaptive batch size calculator
Implementations§
Source§impl AdaptiveBatchSizer
impl AdaptiveBatchSizer
Sourcepub fn new(capabilities: Arc<DeviceCapabilities>) -> Self
pub fn new(capabilities: Arc<DeviceCapabilities>) -> Self
Create a new adaptive batch sizer
Sourcepub fn with_min_batch_size(self, size: usize) -> Self
pub fn with_min_batch_size(self, size: usize) -> Self
Set minimum batch size
Sourcepub fn with_max_batch_size(self, size: usize) -> Self
pub fn with_max_batch_size(self, size: usize) -> Self
Set maximum batch size
Sourcepub fn with_target_utilization(self, utilization: f32) -> Self
pub fn with_target_utilization(self, utilization: f32) -> Self
Set target memory utilization (0.0-1.0)
Sourcepub fn calculate(&self, item_size_bytes: u64, model_size_bytes: u64) -> usize
pub fn calculate(&self, item_size_bytes: u64, model_size_bytes: u64) -> usize
Calculate adaptive batch size
Sourcepub fn adjust_for_pressure(&self, current_batch_size: usize) -> usize
pub fn adjust_for_pressure(&self, current_batch_size: usize) -> usize
Adjust batch size based on current memory pressure
Auto Trait Implementations§
impl Freeze for AdaptiveBatchSizer
impl RefUnwindSafe for AdaptiveBatchSizer
impl Send for AdaptiveBatchSizer
impl Sync for AdaptiveBatchSizer
impl Unpin for AdaptiveBatchSizer
impl UnwindSafe for AdaptiveBatchSizer
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