[−][src]Struct onnxruntime::session::SessionBuilder
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]
self,
opt_level: GraphOptimizationLevel
) -> Result<SessionBuilder>
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]
M: Into<AvailableOnnxModel>,
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]
P: AsRef<Path>,
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
impl RefUnwindSafe for SessionBuilder
impl !Send for SessionBuilder
impl !Sync for SessionBuilder
impl Unpin for SessionBuilder
impl UnwindSafe for SessionBuilder
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
fn instrument(self, span: Span) -> Instrumented<Self>
[src]
fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,