Skip to main content

LinearFactory

Trait LinearFactory 

Source
pub trait LinearFactory<B: Backend>: Send + Sync {
    // Required method
    fn dense(
        &self,
        weight_row_major: &[f32],
        out_features: usize,
        in_features: usize,
    ) -> Box<dyn Linear<B>>;
}
Expand description

Factory for constructing Linear<B> from raw loaded tensors.

A WeightLoader will typically hold a LinearFactory<B> and call it for each layer weight. This indirection keeps the loader independent of any specific Backend.

Required Methods§

Source

fn dense( &self, weight_row_major: &[f32], out_features: usize, in_features: usize, ) -> Box<dyn Linear<B>>

Build a dense Linear from an already-materialised weight buffer.

weight_row_major: [out_features, in_features] laid out contiguously.

Implementors§