Expand description
ONNX export and inference — train once; run in Rust, Python, or any ONNX runtime.
ExportOnnx writes a trained model — or a whole Pipeline — to a single
.onnx file via onnx-export-rs.
InferenceModel loads any ONNX file and runs it: linear / NN graphs
through tract, and the ONNX-ML tree-ensemble
ops tract doesn’t implement (from an exported forest) through a small native
interpreter. So the exported artifact always round-trips back into Rust — a
RandomForest included — and stays portable to every other ONNX runtime.
A pipeline is exported by splicing each leading transformer in front of the
estimator’s graph, in order — scalers as an affine (x - shift) / scale,
imputers as Where(IsNaN(x), fill, x), one-hot encoders as
Concat(Cast(Equal(Round(Gather(x)), cat))) — so the result is one
self-contained graph: raw features in, predictions out. A step with no ONNX
form is reported as an error naming it.
Structs§
- Inference
Model - A loaded ONNX model, ready to run.
Enums§
- Prefix
- A preprocessing step expressible as ONNX graph nodes, prepended in front of an estimator so a whole pipeline becomes one graph. Each maps a same-width feature tensor to another.
Traits§
- Export
Onnx - A model or pipeline that can be exported to ONNX.