pub struct InferenceSession { /* private fields */ }Expand description
Inference session for optimized model execution
Implementations§
Source§impl InferenceSession
impl InferenceSession
Sourcepub fn new(config: InferenceConfig) -> Self
pub fn new(config: InferenceConfig) -> Self
Create a new inference session
Sourcepub fn initialize(&mut self) -> Result<()>
pub fn initialize(&mut self) -> Result<()>
Initialize the session
Sourcepub fn cache_tensor(&mut self, name: String, tensor: Tensor)
pub fn cache_tensor(&mut self, name: String, tensor: Tensor)
Cache a tensor for reuse
Sourcepub fn get_cached(&self, name: &str) -> Option<&Tensor>
pub fn get_cached(&self, name: &str) -> Option<&Tensor>
Get a cached tensor
Sourcepub fn clear_cache(&mut self)
pub fn clear_cache(&mut self)
Clear the cache
Sourcepub fn config(&self) -> &InferenceConfig
pub fn config(&self) -> &InferenceConfig
Get the configuration
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> 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