Skip to main content

Linear

Trait Linear 

Source
pub trait Linear<B>: Send + Sync
where B: Backend,
{ // Required methods fn in_features(&self) -> usize; fn out_features(&self) -> usize; fn forward( &self, ctx: &mut <B as Backend>::Context, input: &<B as Backend>::Buffer, out: &mut <B as Backend>::Buffer, m: usize, ); }
Expand description

A weight-bearing linear projection.

forward computes out[m, out_features] = input[m, in_features] @ W^T. Implementations are responsible for calling the right backend kernel (B::gemm for dense, B::gemm_quant for quantized variants).

Required Methods§

Source

fn in_features(&self) -> usize

Source

fn out_features(&self) -> usize

Source

fn forward( &self, ctx: &mut <B as Backend>::Context, input: &<B as Backend>::Buffer, out: &mut <B as Backend>::Buffer, m: usize, )

Append GEMM work onto ctx. Caller flushes the context when results must be materialised.

Implementors§

Source§

impl<B: Backend> Linear<B> for DenseLinear<B>

Source§

impl<B: Backend> Linear<B> for GgufLinear<B>

Source§

impl<B: Backend> Linear<B> for GptqLinear<B>

Source§

impl<B: Backend> Linear<B> for QuantLinear<B>