Expand description
oxionnx — Pure Rust ONNX inference engine.
Zero C/C++ dependencies. Supports a wide subset of ONNX operators sufficient to run transformer-based models (BERT, T5, GPT-2 family).
§Quick start
use std::collections::HashMap;
use oxionnx::{Session, Tensor};
let session = Session::from_file("model.onnx".as_ref()).unwrap();
let mut inputs = HashMap::new();
inputs.insert("input_ids", Tensor::new(vec![1.0, 2.0, 3.0], vec![1, 3]));
let outputs = session.run(&inputs).unwrap();Re-exports§
pub use benchmark_select::benchmark_elementwise;pub use benchmark_select::benchmark_matmul;pub use benchmark_select::benchmark_suite;pub use benchmark_select::format_results;pub use benchmark_select::BenchmarkResult;pub use benchmark_select::ExecutionPath;pub use memory::BufferPool;pub use memory::MemoryPlan;pub use memory_tracker::MemoryTracker;pub use session::ModelInfo;pub use session::NodeProfile;pub use session::OptLevel;pub use session::Session;pub use session::SessionBuilder;pub use tolerance::compare_tensors;pub use tolerance::tensors_close;pub use tolerance::ToleranceReport;pub use typed_session::Shape;pub use typed_session::TypedSession;
Modules§
- benchmark_
select - Benchmark-based execution path selection.
- graph
- memory
- Static memory planner and activation buffer pool for ONNX inference.
- memory_
tracker - Peak memory usage tracking for inference runs.
- model
- ops
- opset_
coverage - Opset version coverage report generator.
- proto
- session
- tensor
- tolerance
- Numerical tolerance validation for inference results.
- typed_
session - Typed inference API with compile-time shape checking.
Macros§
- define_
shape - Macro to define a shape type.
Structs§
- Attributes
- Parsed attributes for a node.
- Graph
- The full computation graph.
- Node
- A single computation node in the ONNX graph.
- OpContext
- Runtime context passed to every operator during execution.
- Operator
Registry - Maps ONNX op_type strings to operator implementations.
- Tensor
- N-dimensional tensor with f32 data and a shape vector. Layout: row-major (C order), last dimension varies fastest.
Enums§
- Error
- Typed error returned by all public
Sessionmethods. - Onnx
Error - Typed error returned by all public
Sessionmethods. - OpKind
- All ONNX operators currently supported by oxionnx.
Traits§
- Operator
- Trait for ONNX operator implementations. Operators are stateless – all runtime state comes through OpContext.
Functions§
- default_
registry - Build the default operator registry containing all supported ONNX operators.