pub struct BatchProcessor<M: Model> { /* private fields */ }Expand description
Batch processor for efficient model serving
Implementations§
Source§impl<M: Model> BatchProcessor<M>
impl<M: Model> BatchProcessor<M>
Sourcepub fn new(model: M, config: BatchConfig) -> Self
pub fn new(model: M, config: BatchConfig) -> Self
Creates a new batch processor
Sourcepub fn infer(&self, input: RasterBuffer) -> Result<RasterBuffer>
pub fn infer(&self, input: RasterBuffer) -> Result<RasterBuffer>
Submits a request for batch inference
When dynamic batching is enabled, requests are collected and processed
together to improve throughput. For single requests, use DynamicBatchProcessor
for more advanced batching with priority queuing and adaptive sizing.
§Errors
Returns an error if inference fails
Sourcepub fn infer_batch(
&self,
inputs: Vec<RasterBuffer>,
) -> Result<Vec<RasterBuffer>>
pub fn infer_batch( &self, inputs: Vec<RasterBuffer>, ) -> Result<Vec<RasterBuffer>>
Sourcepub fn infer_batch_with_progress(
&self,
inputs: Vec<RasterBuffer>,
show_progress: bool,
) -> Result<Vec<RasterBuffer>>
pub fn infer_batch_with_progress( &self, inputs: Vec<RasterBuffer>, show_progress: bool, ) -> Result<Vec<RasterBuffer>>
Sourcepub fn stats(&self) -> BatchStats
pub fn stats(&self) -> BatchStats
Returns the batch statistics
Sourcepub fn reset_stats(&self)
pub fn reset_stats(&self)
Resets the statistics
Auto Trait Implementations§
impl<M> Freeze for BatchProcessor<M>
impl<M> RefUnwindSafe for BatchProcessor<M>
impl<M> Send for BatchProcessor<M>
impl<M> Sync for BatchProcessor<M>
impl<M> Unpin for BatchProcessor<M>
impl<M> UnsafeUnpin for BatchProcessor<M>
impl<M> UnwindSafe for BatchProcessor<M>
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