Skip to main content

OnnxInterface

Trait OnnxInterface 

Source
pub trait OnnxInterface: Debug {
    type InferenceModel: InferenceModelInterface;

    // Required methods
    fn load_with_options(
        &self,
        path: impl AsRef<Path>,
        options: impl Into<OnnxOptionsSpec>,
    ) -> Result<Self::InferenceModel>;
    fn load_buffer_with_options(
        &self,
        data: &[u8],
        options: impl Into<OnnxOptionsSpec>,
    ) -> Result<Self::InferenceModel>;

    // Provided methods
    fn load(&self, path: impl AsRef<Path>) -> Result<Self::InferenceModel> { ... }
    fn load_buffer(&self, data: &[u8]) -> Result<Self::InferenceModel> { ... }
}

Required Associated Types§

Required Methods§

Source

fn load_with_options( &self, path: impl AsRef<Path>, options: impl Into<OnnxOptionsSpec>, ) -> Result<Self::InferenceModel>

Load a ONNX model from a file, configuring the loader with options.

options is either an OnnxOptions or the JSON for one.

Source

fn load_buffer_with_options( &self, data: &[u8], options: impl Into<OnnxOptionsSpec>, ) -> Result<Self::InferenceModel>

Load a ONNX model from a buffer, configuring the loader with options.

See OnnxInterface::load_with_options.

Provided Methods§

Source

fn load(&self, path: impl AsRef<Path>) -> Result<Self::InferenceModel>

Load a ONNX model from a file into an InferenceModel.

Source

fn load_buffer(&self, data: &[u8]) -> Result<Self::InferenceModel>

Load a ONNX model from a buffer into an InferenceModel.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§