pub trait Linear<B>: Send + Syncwhere
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§
fn in_features(&self) -> usize
fn out_features(&self) -> usize
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".