Skip to main content

Module linear

Module linear 

Source
Expand description

Linear<B> trait — weight-bearing projection abstraction.

Lives in ferrum-kernels alongside Backend because:

  1. Backend::layer_forward_fused and other “standard transformer layer” helpers want to accept &dyn Linear<Self> as their projection parameter, so the trait must be visible here.
  2. Model code in ferrum-models depends on both ferrum-kernels and ferrum-quantization, so keeping the trait in kernels avoids any circular dependency between kernels and quantization.

Concrete implementations (DenseLinear, GptqLinear, AwqLinear, GgufLinear) live in ferrum-quantization, which depends on ferrum-kernels for this trait and for the Backend it parameterises over.

Traits§

Linear
A weight-bearing linear projection.