pub struct DynamicBatchManager { /* private fields */ }Expand description
Dynamic batch manager
Implementations§
Source§impl DynamicBatchManager
impl DynamicBatchManager
Sourcepub fn new(strategy: BatchingStrategy) -> Self
pub fn new(strategy: BatchingStrategy) -> Self
Create a new dynamic batch manager
Sourcepub fn record_latency(&mut self, latency_ms: f64)
pub fn record_latency(&mut self, latency_ms: f64)
Record latency for adaptive batching
Sourcepub fn add_tensor(&mut self, tensor: Tensor, priority: usize) -> Result<()>
pub fn add_tensor(&mut self, tensor: Tensor, priority: usize) -> Result<()>
Add a tensor to the pending queue with priority
Sourcepub fn get_next_batch(&mut self) -> Result<Option<Vec<Tensor>>>
pub fn get_next_batch(&mut self) -> Result<Option<Vec<Tensor>>>
Get the next optimal batch based on the strategy
Sourcepub fn pending_count(&self) -> usize
pub fn pending_count(&self) -> usize
Get number of pending tensors
Sourcepub fn current_batch_size(&self) -> usize
pub fn current_batch_size(&self) -> usize
Get current batch size for adaptive strategies
Sourcepub fn average_latency(&self) -> f64
pub fn average_latency(&self) -> f64
Get average latency for performance analysis
Sourcepub fn get_batch_statistics(&self) -> BatchStatistics
pub fn get_batch_statistics(&self) -> BatchStatistics
Get batch processing statistics
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DynamicBatchManager
impl RefUnwindSafe for DynamicBatchManager
impl Send for DynamicBatchManager
impl Sync for DynamicBatchManager
impl Unpin for DynamicBatchManager
impl UnsafeUnpin for DynamicBatchManager
impl UnwindSafe for DynamicBatchManager
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