pub struct Session { /* private fields */ }
Expand description
Implementations§
Source§impl Session
impl Session
pub async fn from_path<P: AsRef<Path>>(path: P) -> Result<Session, SessionError>
pub async fn from_path_with_config<P: AsRef<Path>>( path: P, config: &SessionConfig, ) -> Result<Session, SessionError>
Sourcepub async fn from_bytes(bytes: &[u8]) -> Result<Session, SessionError>
pub async fn from_bytes(bytes: &[u8]) -> Result<Session, SessionError>
Read an ONNX model from bytes and create a session, using default session config.
Sourcepub async fn from_bytes_with_config(
bytes: &[u8],
config: &SessionConfig,
) -> Result<Session, SessionError>
pub async fn from_bytes_with_config( bytes: &[u8], config: &SessionConfig, ) -> Result<Session, SessionError>
Read an ONNX model from bytes and create a session with the specified session config.
Sourcepub async fn from_model_with_config(
model: ModelProto,
config: &SessionConfig,
) -> Result<Session, SessionError>
pub async fn from_model_with_config( model: ModelProto, config: &SessionConfig, ) -> Result<Session, SessionError>
Create a session using the provided onnx::ModelProto
and session config.
Sourcepub async fn from_model(model: ModelProto) -> Result<Session, SessionError>
pub async fn from_model(model: ModelProto) -> Result<Session, SessionError>
Create a Session given an ONNX model, using default configuration.
Sourcepub async fn run<'a>(
&self,
inputs: &HashMap<String, InputTensor<'a>>,
) -> Result<HashMap<String, OutputTensor>, SessionError>
pub async fn run<'a>( &self, inputs: &HashMap<String, InputTensor<'a>>, ) -> Result<HashMap<String, OutputTensor>, SessionError>
Perform inference given the inputs provided and return all the outputs the model was compiled to return.
Auto Trait Implementations§
impl Freeze for Session
impl !RefUnwindSafe for Session
impl Send for Session
impl Sync for Session
impl Unpin for Session
impl !UnwindSafe for Session
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