pub struct InferenceSession {
pub id: SessionId,
pub model: Arc<ModelGraph>,
pub config: SessionConfig,
pub statistics: Arc<RwLock<SessionStatistics>>,
/* private fields */
}Expand description
An active inference session.
Fields§
§id: SessionIdUnique session identifier.
model: Arc<ModelGraph>The model graph for this session.
config: SessionConfigSession configuration.
statistics: Arc<RwLock<SessionStatistics>>Runtime statistics.
Implementations§
Source§impl InferenceSession
impl InferenceSession
Sourcepub fn new(model: ModelGraph, config: SessionConfig) -> Self
pub fn new(model: ModelGraph, config: SessionConfig) -> Self
Create a new inference session.
Sourcepub async fn run_inference(&self, inputs: &[Tensor]) -> Result<Vec<Tensor>>
pub async fn run_inference(&self, inputs: &[Tensor]) -> Result<Vec<Tensor>>
Run inference on the session.
Sourcepub async fn get_statistics(&self) -> SessionStatistics
pub async fn get_statistics(&self) -> SessionStatistics
Get session statistics.
Sourcepub async fn get_resource_usage(&self) -> ResourceUsage
pub async fn get_resource_usage(&self) -> ResourceUsage
Get current resource usage.
Sourcepub fn mark_for_deletion(&mut self)
pub fn mark_for_deletion(&mut self)
Mark session for deletion.
Sourcepub fn is_marked_for_deletion(&self) -> bool
pub fn is_marked_for_deletion(&self) -> bool
Check if session is marked for deletion.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for InferenceSession
impl !RefUnwindSafe for InferenceSession
impl Send for InferenceSession
impl Sync for InferenceSession
impl Unpin for InferenceSession
impl !UnwindSafe for InferenceSession
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