pub struct SessionConfig {
pub preferred_providers: Vec<ExecutionProvider>,
pub intra_threads: Option<usize>,
pub inter_threads: Option<usize>,
pub parallel_execution: bool,
pub optimization_level: OptimizationLevel,
pub enable_mem_arena: bool,
pub pool_size: usize,
pub optimized_model_path: Option<PathBuf>,
}Expand description
ONNX Runtime セッション構築設定。
Fields§
§preferred_providers: Vec<ExecutionProvider>優先的に試行する Execution Provider の順序付きリスト。
intra_threads: Option<usize>単一オペレータ内の並列スレッド数 (intra_op)。None の場合は物理コア数から自動算出。
inter_threads: Option<usize>複数オペレータ間の並列スレッド数 (inter_op)。None の場合は自動設定 (通常は 1)。
parallel_execution: boolグラフ内の並列実行モード (false で Sequential、true で Parallel)。
optimization_level: OptimizationLevelグラフ最適化レベル。
enable_mem_arena: boolCPU メモリアリーナの有効化。
pool_size: usize並行推論用セッションプールサイズ (デフォルト: 1)。
optimized_model_path: Option<PathBuf>最適化済みモデルグラフのディスク保存・キャッシュパス (任意)。
Implementations§
Source§impl SessionConfig
impl SessionConfig
Sourcepub fn for_tier1() -> Self
pub fn for_tier1() -> Self
Tier 1 (130M-INT8) モデル向けの推奨セッション設定を生成する。
軽量モデルの短時間フォワードパス (~12ms) においてスレッド同期オーバーヘッドを抑えるため、
intra_threads の上限を 4 スレッドに制限する。
Sourcepub fn for_tier2() -> Self
pub fn for_tier2() -> Self
Tier 2 (310M-INT8) モデル向けの推奨セッション設定を生成する。
計算負荷の高い GEMM 演算を高速化するため、物理コア数に応じて最大 8 スレッドまで割り当てる。
Sourcepub fn with_auto_threads(self) -> Self
pub fn with_auto_threads(self) -> Self
現在のセッションプール数に基づき、スレッド数を自動計算して適用する。
Sourcepub fn with_threads(self, intra: Option<usize>, inter: Option<usize>) -> Self
pub fn with_threads(self, intra: Option<usize>, inter: Option<usize>) -> Self
スレッド数を明示指定したビルダーメソッド。
Sourcepub fn with_parallel_execution(self, parallel: bool) -> Self
pub fn with_parallel_execution(self, parallel: bool) -> Self
並列実行フラグを指定したビルダーメソッド。
Sourcepub fn with_optimization_level(self, level: OptimizationLevel) -> Self
pub fn with_optimization_level(self, level: OptimizationLevel) -> Self
最適化レベルを指定したビルダーメソッド。
Sourcepub fn with_memory_arena(self, enable: bool) -> Self
pub fn with_memory_arena(self, enable: bool) -> Self
メモリアリーナ有効化フラグを指定したビルダーメソッド。
Sourcepub fn with_pool_size(self, size: usize) -> Self
pub fn with_pool_size(self, size: usize) -> Self
セッションプールサイズを指定したビルダーメソッド。
Sourcepub fn with_optimized_model_path(self, path: impl Into<PathBuf>) -> Self
pub fn with_optimized_model_path(self, path: impl Into<PathBuf>) -> Self
最適化済みモデルの保存・キャッシュパスを指定したビルダーメソッド。
Trait Implementations§
Source§impl Clone for SessionConfig
impl Clone for SessionConfig
Source§fn clone(&self) -> SessionConfig
fn clone(&self) -> SessionConfig
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SessionConfig
impl Debug for SessionConfig
Auto Trait Implementations§
impl Freeze for SessionConfig
impl RefUnwindSafe for SessionConfig
impl Send for SessionConfig
impl Sync for SessionConfig
impl Unpin for SessionConfig
impl UnsafeUnpin for SessionConfig
impl UnwindSafe for SessionConfig
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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> ⓘ
Converts
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> ⓘ
Converts
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 more