pub struct OrtSessionConfig {
pub intra_threads: Option<usize>,
pub inter_threads: Option<usize>,
pub parallel_execution: Option<bool>,
pub optimization_level: Option<OrtGraphOptimizationLevel>,
pub execution_providers: Option<Vec<OrtExecutionProvider>>,
pub enable_mem_pattern: Option<bool>,
pub log_severity_level: Option<i32>,
pub log_verbosity_level: Option<i32>,
pub session_config_entries: Option<HashMap<String, String>>,
}Expand description
Configuration for ONNX Runtime sessions.
This struct contains various configuration options for ONNX Runtime sessions, including threading, memory management, and optimization settings.
Fields§
§intra_threads: Option<usize>Number of threads used to parallelize execution within nodes
inter_threads: Option<usize>Number of threads used to parallelize execution across nodes
parallel_execution: Option<bool>Enable parallel execution mode
optimization_level: Option<OrtGraphOptimizationLevel>Graph optimization level
execution_providers: Option<Vec<OrtExecutionProvider>>Execution providers in order of preference
enable_mem_pattern: Option<bool>Enable memory pattern optimization
log_severity_level: Option<i32>Log severity level (0=Verbose, 1=Info, 2=Warning, 3=Error, 4=Fatal)
log_verbosity_level: Option<i32>Log verbosity level
session_config_entries: Option<HashMap<String, String>>Session configuration entries (key-value pairs)
Implementations§
Source§impl OrtSessionConfig
impl OrtSessionConfig
Sourcepub fn new() -> OrtSessionConfig
pub fn new() -> OrtSessionConfig
Creates a new OrtSessionConfig with default values.
Sourcepub fn with_intra_threads(self, threads: usize) -> OrtSessionConfig
pub fn with_intra_threads(self, threads: usize) -> OrtSessionConfig
Sourcepub fn with_inter_threads(self, threads: usize) -> OrtSessionConfig
pub fn with_inter_threads(self, threads: usize) -> OrtSessionConfig
Sourcepub fn with_parallel_execution(self, enabled: bool) -> OrtSessionConfig
pub fn with_parallel_execution(self, enabled: bool) -> OrtSessionConfig
Sourcepub fn with_optimization_level(
self,
level: OrtGraphOptimizationLevel,
) -> OrtSessionConfig
pub fn with_optimization_level( self, level: OrtGraphOptimizationLevel, ) -> OrtSessionConfig
Sourcepub fn with_execution_providers(
self,
providers: Vec<OrtExecutionProvider>,
) -> OrtSessionConfig
pub fn with_execution_providers( self, providers: Vec<OrtExecutionProvider>, ) -> OrtSessionConfig
Sourcepub fn add_execution_provider(
self,
provider: OrtExecutionProvider,
) -> OrtSessionConfig
pub fn add_execution_provider( self, provider: OrtExecutionProvider, ) -> OrtSessionConfig
Sourcepub fn with_memory_pattern(self, enable: bool) -> OrtSessionConfig
pub fn with_memory_pattern(self, enable: bool) -> OrtSessionConfig
Sourcepub fn with_log_severity_level(self, level: i32) -> OrtSessionConfig
pub fn with_log_severity_level(self, level: i32) -> OrtSessionConfig
Sourcepub fn with_log_verbosity_level(self, level: i32) -> OrtSessionConfig
pub fn with_log_verbosity_level(self, level: i32) -> OrtSessionConfig
Sourcepub fn add_config_entry<K, V>(self, key: K, value: V) -> OrtSessionConfig
pub fn add_config_entry<K, V>(self, key: K, value: V) -> OrtSessionConfig
Sourcepub fn get_intra_threads(&self) -> usize
pub fn get_intra_threads(&self) -> usize
Gets the effective number of intra-op threads.
§Returns
The number of intra-op threads, or a default value if not set.
Sourcepub fn get_inter_threads(&self) -> usize
pub fn get_inter_threads(&self) -> usize
Gets the effective number of inter-op threads.
§Returns
The number of inter-op threads, or a default value if not set.
Sourcepub fn get_optimization_level(&self) -> OrtGraphOptimizationLevel
pub fn get_optimization_level(&self) -> OrtGraphOptimizationLevel
Gets the effective graph optimization level.
§Returns
The graph optimization level, or a default value if not set.
Sourcepub fn get_execution_providers(&self) -> Vec<OrtExecutionProvider>
pub fn get_execution_providers(&self) -> Vec<OrtExecutionProvider>
Gets the execution providers.
§Returns
A reference to the execution providers, or a default CPU provider if not set.
Trait Implementations§
Source§impl Clone for OrtSessionConfig
impl Clone for OrtSessionConfig
Source§fn clone(&self) -> OrtSessionConfig
fn clone(&self) -> OrtSessionConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for OrtSessionConfig
impl Debug for OrtSessionConfig
Source§impl Default for OrtSessionConfig
impl Default for OrtSessionConfig
Source§fn default() -> OrtSessionConfig
fn default() -> OrtSessionConfig
Source§impl<'de> Deserialize<'de> for OrtSessionConfig
impl<'de> Deserialize<'de> for OrtSessionConfig
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<OrtSessionConfig, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<OrtSessionConfig, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Serialize for OrtSessionConfig
impl Serialize for OrtSessionConfig
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Auto Trait Implementations§
impl Freeze for OrtSessionConfig
impl RefUnwindSafe for OrtSessionConfig
impl Send for OrtSessionConfig
impl Sync for OrtSessionConfig
impl Unpin for OrtSessionConfig
impl UnsafeUnpin for OrtSessionConfig
impl UnwindSafe for OrtSessionConfig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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>
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.