pub struct Inference<B: Backend, M, I, O, S = ()> {
pub id: String,
/* private fields */
}Expand description
Inference instance wrapping a single model and a handler routine.
An Inference can create multiple jobs (sequentially or concurrently) without re-loading the model.
Fields§
§id: StringImplementations§
Source§impl<B, M, I, O, S> Inference<B, M, I, O, S>
impl<B, M, I, O, S> Inference<B, M, I, O, S>
Sourcepub fn infer(
&self,
input: I::Inner<'static>,
) -> StrappedInferenceJobBuilder<'_, B, M, I, O, S, StateMissing>
pub fn infer( &self, input: I::Inner<'static>, ) -> StrappedInferenceJobBuilder<'_, B, M, I, O, S, StateMissing>
Start building an inference job for the given input payload.
Sourcepub fn run(&self, job: InferenceJob<B, I, S>) -> Result<Vec<O>, InferenceError>
pub fn run(&self, job: InferenceJob<B, I, S>) -> Result<Vec<O>, InferenceError>
Execute the provided job synchronously and collect all emitted outputs.
Sourcepub fn spawn(&self, job: InferenceJob<B, I, S>) -> JobHandle<O>where
<I as RoutineInput>::Inner<'static>: Send,
pub fn spawn(&self, job: InferenceJob<B, I, S>) -> JobHandle<O>where
<I as RoutineInput>::Inner<'static>: Send,
Spawn the job on a background thread returning a JobHandle. Outputs can be read from the handle’s stream.
Sourcepub fn into_model(self) -> M
pub fn into_model(self) -> M
Consume the inference instance and retrieve ownership of the underlying model.
Auto Trait Implementations§
impl<B, M, I, O, S> Freeze for Inference<B, M, I, O, S>
impl<B, M, I, O, S = ()> !RefUnwindSafe for Inference<B, M, I, O, S>
impl<B, M, I, O, S> Send for Inference<B, M, I, O, S>
impl<B, M, I, O, S> Sync for Inference<B, M, I, O, S>
impl<B, M, I, O, S> Unpin for Inference<B, M, I, O, S>
impl<B, M, I, O, S = ()> !UnwindSafe for Inference<B, M, I, O, S>
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