[][src]Struct onnxruntime::session::SessionBuilder

pub struct SessionBuilder { /* fields omitted */ }

Type used to create a session using the builder pattern

A SessionBuilder is created by calling the Environment::new_session_builder() method on the environment.

Once created, use the different methods to configure the session.

Once configured, use the SessionBuilder::with_model_from_file() method to "commit" the builder configuration into a Session.

Example

let environment = Environment::builder()
    .with_name("test")
    .with_log_level(LoggingLevel::Verbose)
    .build()?;
let mut session = environment
    .new_session_builder()?
    .with_optimization_level(GraphOptimizationLevel::Basic)?
    .with_number_threads(1)?
    .with_model_from_file("squeezenet.onnx")?;

Implementations

impl SessionBuilder[src]

pub fn with_number_threads(self, num_threads: i16) -> Result<SessionBuilder>[src]

Configure the session to use a number of threads

pub fn with_optimization_level(
    self,
    opt_level: GraphOptimizationLevel
) -> Result<SessionBuilder>
[src]

Set the session's optimization level

pub fn with_allocator(self, allocator: AllocatorType) -> Result<SessionBuilder>[src]

Set the session's allocator

Defaults to AllocatorType::Arena

pub fn with_memory_type(self, memory_type: MemType) -> Result<SessionBuilder>[src]

Set the session's memory type

Defaults to MemType::Default

pub fn with_model_downloaded<M>(self, model: M) -> Result<Session> where
    M: Into<AvailableOnnxModel>, 
[src]

Download an ONNX pre-trained model from the ONNX Model Zoo and commit the session

pub fn with_model_from_file<P>(self, model_filepath: P) -> Result<Session> where
    P: AsRef<Path>, 
[src]

Load an ONNX graph from a file and commit the session

Trait Implementations

impl Debug for SessionBuilder[src]

impl Drop for SessionBuilder[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.