pub struct SessionOptions {
pub provider: ExecutionProvider,
pub device_id: Option<i32>,
pub threads: Option<usize>,
pub directml_static_shape_workaround: bool,
pub cpu_fallback: bool,
}Fields§
§provider: ExecutionProvider§device_id: Option<i32>DirectML adapter index; None lets the runtime pick.
threads: Option<usize>Explicit intra-op threads. Opts the session out of the shared pool.
directml_static_shape_workaround: boolSet for graphs with a fixed time dimension run on DirectML: applies the HeardRight-measured fusion workaround (ORT-DirectML 1.24.4 silently returns near-zero output for static-shape conformer encoders). Remove once a fixed onnxruntime-directml release passes the corpus.
cpu_fallback: boolWhen the requested accelerator is unsupported on this OS, fails to
register, or fails to load the model, build a CPU session instead.
Off by default: failures are errors. The fallback is never silent;
BuiltSession::fallback records why it happened.
Implementations§
Source§impl SessionOptions
impl SessionOptions
pub fn new(provider: ExecutionProvider) -> Self
pub fn with_device_id(self, device_id: Option<i32>) -> Self
pub fn with_threads(self, threads: Option<usize>) -> Self
pub fn with_cpu_fallback(self, cpu_fallback: bool) -> Self
Sourcepub fn cpu_for_stage(&self) -> Self
pub fn cpu_for_stage(&self) -> Self
Same options forced to CPU, for dispatch-bound stages (mel, decoder/joint).
pub fn build_from_file(&self, path: &Path) -> Result<Session, SessionError>
pub fn build_from_memory(&self, bytes: &[u8]) -> Result<Session, SessionError>
Sourcepub fn build_from_file_reported(
&self,
path: &Path,
) -> Result<BuiltSession, SessionError>
pub fn build_from_file_reported( &self, path: &Path, ) -> Result<BuiltSession, SessionError>
Like Self::build_from_file, also reporting the effective provider.
Sourcepub fn build_from_memory_reported(
&self,
bytes: &[u8],
) -> Result<BuiltSession, SessionError>
pub fn build_from_memory_reported( &self, bytes: &[u8], ) -> Result<BuiltSession, SessionError>
Like Self::build_from_memory, also reporting the effective provider.