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§
- Cache
Stats - Observable kernel-cache statistics (§11.1) — enough to prove reuse in tests.
- Compiled
Partition - One compiled partition the session hands to the EPContext writer (§55.4).
- Encoder
Model - An IR
Graphbundled with the model-level metadata and live weight bytes needed to encode a complete ONNXModelProto. - EpContext
Dump Config - Configuration for the EPContext dump path (§55.4).
- EpContext
Partition - One EP-compiled partition to serialise into an
EPContextnode (§55.4). - EpContext
Placement - Outcome of the EPContext consume pass over a graph (§55.3).
- Inference
Session - A loaded model ready to run inference (§20.2).
- IoMeta
- Metadata describing a model input or output (§20.2).
- Session
Builder - Builder for advanced session configuration (§20.6).
- Tensor
- An owned, host-resident, device-aware tensor (§5, §20.2).
- Warmup
Shape - A shape to pre-compile kernels for at session init (§11.3).
Enums§
- Device
Preference - Intent-based device preference (§20.4). The runtime maps this to concrete
EPs during
build. - Optimization
Level - Graph-optimization level for the session’s
optimizepipeline stage (docs/ORT2.md§18). Selected via the generic"optimization"session option (seeSessionBuilder::option). - Session
Error - Errors produced by the session layer.
Functions§
- dump_
session_ ep_ context - Drive the §55.4 dump path: serialise
modelto a*_ctx.onnxcontext-cache model, replacing each compiledpartition’s subgraph with a singlecom.microsoft::EPContextnode. - load
- Load a model. Auto-detects the best available hardware (§20.2).
- load_
ep_ context_ nodes - Consume every
com.microsoft::EPContextnode ingraph(§55.3).