Skip to main content

ExportOnnx

Trait ExportOnnx 

Source
pub trait ExportOnnx {
    // Required method
    fn to_onnx(&self) -> Result<ModelProto>;

    // Provided method
    fn export_onnx(&self, path: impl AsRef<Path>) -> Result<()> { ... }
}
Expand description

A model or pipeline that can be exported to ONNX.

Required Methods§

Source

fn to_onnx(&self) -> Result<ModelProto>

Build the ONNX graph for this object.

Provided Methods§

Source

fn export_onnx(&self, path: impl AsRef<Path>) -> Result<()>

Write the ONNX graph to path.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl ExportOnnx for LinearRegression

Available on crate feature onnx only.

Export a fitted LinearRegression to an ONNX Gemm graph.

The canonical weights are read from smartcore’s own coefficient/intercept accessors, so this is independent of onnx-export’s smartcore version. Unlike the tree ensemble, the resulting graph runs in tract.

Source§

impl ExportOnnx for Pipeline

Available on crate feature onnx only.

Export the whole pipeline as one ONNX graph: each leading transformer that can express itself as ONNX nodes (scalers as an affine map, imputers as a Where(IsNaN, fill, x), one-hot encoders as a Gather/Equal/Concat expansion) is spliced in front of the estimator’s graph, in order. A step with no ONNX form is reported as an error naming it; the train-time balancer is inference-irrelevant and skipped.

Source§

impl ExportOnnx for RandomForest

Available on crate feature onnx only.

Export a fitted RandomForest to an ONNX tree-ensemble classifier.

Uses onnx-export-rs’s serde-based compat adapter, so it is independent of the smartcore version onnx-export itself was built against.