Skip to main content

ModelSession

Trait ModelSession 

Source
pub trait ModelSession: Send {
    // Required methods
    fn backend_name(&self) -> &str;
    fn model_info(&self) -> &ModelInfo;
    fn run_with_options(
        &mut self,
        inputs: NamedTensors,
        options: RunOptions,
    ) -> AiResult<NamedTensors>;

    // Provided methods
    fn run(&mut self, inputs: NamedTensors) -> AiResult<NamedTensors> { ... }
    fn run_with_binding(&mut self, _binding: &mut IoBinding) -> AiResult<()> { ... }
}
Expand description

Loaded model session with named dynamic I/O.

Required Methods§

Source

fn backend_name(&self) -> &str

Stable backend identifier for diagnostics and capability checks.

Source

fn model_info(&self) -> &ModelInfo

Returns model input/output metadata captured at load time.

Source

fn run_with_options( &mut self, inputs: NamedTensors, options: RunOptions, ) -> AiResult<NamedTensors>

Runs named I/O with explicit host copy permissions.

Provided Methods§

Source

fn run(&mut self, inputs: NamedTensors) -> AiResult<NamedTensors>

Runs without authorizing hidden host copies.

Source

fn run_with_binding(&mut self, _binding: &mut IoBinding) -> AiResult<()>

Runs with explicit input/output device or allocation bindings.

Implementors§