Skip to main content

WeightProvider

Trait WeightProvider 

Source
pub trait WeightProvider: Send + Sync {
    // Required methods
    fn get_tensor(&self, name: &str) -> Result<Tensor>;
    fn has_tensor(&self, name: &str) -> bool;
    fn tensor_names(&self) -> Vec<String>;
    fn preload(&mut self, names: &[&str]) -> Result<()>;
}
Expand description

Trait for providing weights to models

Required Methods§

Source

fn get_tensor(&self, name: &str) -> Result<Tensor>

Get a tensor by name, loading it if necessary

Source

fn has_tensor(&self, name: &str) -> bool

Check if a tensor exists

Source

fn tensor_names(&self) -> Vec<String>

Get all tensor names (for config detection)

Source

fn preload(&mut self, names: &[&str]) -> Result<()>

Preload a set of tensors (for optimization)

Implementors§