Skip to main content

Crate oxionnx

Crate oxionnx 

Source
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.
OperatorRegistry
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 Session methods.
OnnxError
Typed error returned by all public Session methods.
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.