pub trait Linear<B: Backend>: Send + Sync {
// Required methods
fn in_features(&self) -> usize;
fn out_features(&self) -> usize;
fn forward(
&self,
ctx: &mut B::Context,
input: &B::Buffer,
out: &mut B::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).