Skip to main content

InferenceBackend

Trait InferenceBackend 

Source
pub trait InferenceBackend: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn create_session(
        &self,
        source: &ModelSource,
        options: &SessionOptions,
    ) -> AiResult<Box<dyn ModelSession>>;
}
Expand description

Stable interface implemented by inference engines.

Required Methods§

Source

fn name(&self) -> &str

Stable backend identifier such as onnxruntime-cpu.

Source

fn create_session( &self, source: &ModelSource, options: &SessionOptions, ) -> AiResult<Box<dyn ModelSession>>

Loads one model and returns an independent mutable session.

Implementors§