Skip to main content

Crate onnx_runtime_session

Crate onnx_runtime_session 

Source
Expand description

§onnx-runtime-session

The user-facing session and inference API for the ORT 2.0 runtime (see docs/ORT2.md §20). Design goal: zero-config by default — the user never has to know what an execution provider is; the runtime auto-detects hardware and picks a strategy.

Phase 1 skeleton: the intent-based SessionBuilder and InferenceSession surfaces are defined; build/run bodies are todo!() pending the sequential executor (Phase 1 task ort2-session).

let mut session = onnx_runtime_session::load("model.onnx")?;
let outputs = session.run(&[("input_ids", &tensor)])?;

Structs§

CacheStats
Observable kernel-cache statistics (§11.1) — enough to prove reuse in tests.
CompiledPartition
One compiled partition the session hands to the EPContext writer (§55.4).
EncoderModel
An IR Graph bundled with the model-level metadata and live weight bytes needed to encode a complete ONNX ModelProto.
EpContextDumpConfig
Configuration for the EPContext dump path (§55.4).
EpContextPartition
One EP-compiled partition to serialise into an EPContext node (§55.4).
EpContextPlacement
Outcome of the EPContext consume pass over a graph (§55.3).
InferenceSession
A loaded model ready to run inference (§20.2).
IoMeta
Metadata describing a model input or output (§20.2).
SessionBuilder
Builder for advanced session configuration (§20.6).
Tensor
An owned, host-resident, device-aware tensor (§5, §20.2).
WarmupShape
A shape to pre-compile kernels for at session init (§11.3).

Enums§

DevicePreference
Intent-based device preference (§20.4). The runtime maps this to concrete EPs during build.
OptimizationLevel
Graph-optimization level for the session’s optimize pipeline stage (docs/ORT2.md §18). Selected via the generic "optimization" session option (see SessionBuilder::option).
SessionError
Errors produced by the session layer.

Functions§

dump_session_ep_context
Drive the §55.4 dump path: serialise model to a *_ctx.onnx context-cache model, replacing each compiled partition’s subgraph with a single com.microsoft::EPContext node.
load
Load a model. Auto-detects the best available hardware (§20.2).
load_ep_context_nodes
Consume every com.microsoft::EPContext node in graph (§55.3).