pub struct SessionManager { /* private fields */ }Expand description
Thread-safe session manager for managing inference sessions.
Implementations§
Source§impl SessionManager
impl SessionManager
Sourcepub fn with_config(
global_memory_limit: Option<usize>,
max_sessions: Option<usize>,
default_config: SessionConfig,
) -> Self
pub fn with_config( global_memory_limit: Option<usize>, max_sessions: Option<usize>, default_config: SessionConfig, ) -> Self
Create a new session manager with configuration.
Sourcepub async fn create_session(&self, model: ModelGraph) -> Result<SessionId>
pub async fn create_session(&self, model: ModelGraph) -> Result<SessionId>
Create a new inference session.
Sourcepub async fn create_session_with_config(
&self,
model: ModelGraph,
config: Option<SessionConfig>,
) -> Result<SessionId>
pub async fn create_session_with_config( &self, model: ModelGraph, config: Option<SessionConfig>, ) -> Result<SessionId>
Create a new inference session with custom configuration.
Sourcepub fn get_session(
&self,
session_id: SessionId,
) -> Option<Arc<InferenceSession>>
pub fn get_session( &self, session_id: SessionId, ) -> Option<Arc<InferenceSession>>
Get a session by ID.
Sourcepub async fn run_inference(
&self,
session_id: SessionId,
inputs: Vec<Tensor>,
) -> Result<Vec<Tensor>>
pub async fn run_inference( &self, session_id: SessionId, inputs: Vec<Tensor>, ) -> Result<Vec<Tensor>>
Run inference on a session.
Sourcepub async fn destroy_session(&self, session_id: SessionId) -> Result<()>
pub async fn destroy_session(&self, session_id: SessionId) -> Result<()>
Destroy a session.
Sourcepub async fn get_session_statistics(
&self,
session_id: SessionId,
) -> Result<SessionStatistics>
pub async fn get_session_statistics( &self, session_id: SessionId, ) -> Result<SessionStatistics>
Get session statistics.
Sourcepub fn list_sessions(&self) -> Vec<SessionId> ⓘ
pub fn list_sessions(&self) -> Vec<SessionId> ⓘ
List all active session IDs.
Sourcepub fn session_count(&self) -> usize
pub fn session_count(&self) -> usize
Get the number of active sessions.
Sourcepub async fn cleanup_expired_sessions(&self) -> usize
pub async fn cleanup_expired_sessions(&self) -> usize
Cleanup expired sessions.
Sourcepub async fn get_global_statistics(&self) -> GlobalStatistics
pub async fn get_global_statistics(&self) -> GlobalStatistics
Get global statistics across all sessions.
Trait Implementations§
Source§impl Debug for SessionManager
impl Debug for SessionManager
Auto Trait Implementations§
impl Freeze for SessionManager
impl !RefUnwindSafe for SessionManager
impl Send for SessionManager
impl Sync for SessionManager
impl Unpin for SessionManager
impl !UnwindSafe for SessionManager
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