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 enable_cpu_mem_arena: Option<bool>,
pub memory_arena_extend_strategy: Option<String>,
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
enable_cpu_mem_arena: Option<bool>Enable CPU memory arena
memory_arena_extend_strategy: Option<String>Memory arena extend strategy
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 with_intra_threads(self, threads: usize) -> Self
pub fn with_intra_threads(self, threads: usize) -> Self
Sourcepub fn with_inter_threads(self, threads: usize) -> Self
pub fn with_inter_threads(self, threads: usize) -> Self
Sourcepub fn with_parallel_execution(self, enabled: bool) -> Self
pub fn with_parallel_execution(self, enabled: bool) -> Self
Sourcepub fn with_optimization_level(self, level: OrtGraphOptimizationLevel) -> Self
pub fn with_optimization_level(self, level: OrtGraphOptimizationLevel) -> Self
Sourcepub fn with_execution_providers(
self,
providers: Vec<OrtExecutionProvider>,
) -> Self
pub fn with_execution_providers( self, providers: Vec<OrtExecutionProvider>, ) -> Self
Sourcepub fn add_execution_provider(self, provider: OrtExecutionProvider) -> Self
pub fn add_execution_provider(self, provider: OrtExecutionProvider) -> Self
Sourcepub fn with_memory_pattern(self, enable: bool) -> Self
pub fn with_memory_pattern(self, enable: bool) -> Self
Sourcepub fn with_cpu_memory_arena(self, enable: bool) -> Self
pub fn with_cpu_memory_arena(self, enable: bool) -> Self
Sourcepub fn with_log_severity_level(self, level: i32) -> Self
pub fn with_log_severity_level(self, level: i32) -> Self
Sourcepub fn with_log_verbosity_level(self, level: i32) -> Self
pub fn with_log_verbosity_level(self, level: i32) -> Self
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<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for OrtSessionConfig
impl RefUnwindSafe for OrtSessionConfig
impl Send for OrtSessionConfig
impl Sync for OrtSessionConfig
impl Unpin 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.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.