Realm

oa::ml::nn::QuantizedLinear

Affine map x @ W^T + b whose weight stays packed in a QuantMatrix. QuantizedLinear is the model-level quantized-inference contract: the weight is frozen at quantization time, exposes no trainable parameters, and the forward pass dequantizes inside the dispatch rather than materializing an F32 weight on the device. State-dict round-trips run the standard quantize-on-export flow — checkpoints carry the F32 module and from_linear re-derives the packed planes.

StRust public API

Declaration

pub struct QuantizedLinear { /* private fields */ }
Public Rust declaration.

Public Methods

pub const fn input_features(&self) -> usize
pub const fn output_features(&self) -> usize
pub const fn quantization(&self) -> Quantization
pub const fn weight(&self) -> &QuantMatrix
pub const fn bias(&self) -> Option<&Matrix>
fn forward(&self, input: &Matrix) -> Result<Matrix>
fn registry(&self) -> &ModuleRegistry
fn parameters(&self) -> Vec<Parameter>
fn named_parameters(&self) -> Vec<NamedParameter>
fn buffers(&self) -> Vec<Matrix>
fn named_buffers(&self) -> Vec<NamedBuffer>
fn all_parameters(&self) -> Result<Vec<Parameter>>
fn all_named_parameters(&self) -> Result<Vec<NamedParameter>>
fn all_named_buffers(&self) -> Result<Vec<NamedBuffer>>
fn all_named_state_u32(&self) -> Result<Vec<NamedStateU32>>
fn num_parameters(&self) -> Result<usize>
fn train(&self, training: bool)
fn eval(&self)
fn is_training(&self) -> bool
fn scoped_eval(&self) -> ScopedEval<'_>

Associated Functions

pub fn from_linear(linear: &Linear, quantization: Quantization) -> Result<Self>
pub fn from_quantized(weight: QuantMatrix, bias: Option<Matrix>) -> Result<Self>

Public Method Documentation

pub const fn input_features( &self ) -> usize
No public source comment is attached to this declaration.
pub const fn output_features( &self ) -> usize
No public source comment is attached to this declaration.
pub const fn quantization( &self ) -> Quantization
No public source comment is attached to this declaration.
pub const fn weight( &self ) -> &QuantMatrix
No public source comment is attached to this declaration.
pub const fn bias( &self ) -> Option<&Matrix>
No public source comment is attached to this declaration.
fn forward( &self, input: &Matrix ) -> Result<Matrix>
No public source comment is attached to this declaration.
fn registry( &self ) -> &ModuleRegistry
No public source comment is attached to this declaration.
fn parameters( &self ) -> Vec<Parameter>
No public source comment is attached to this declaration.
fn named_parameters( &self ) -> Vec<NamedParameter>
No public source comment is attached to this declaration.
fn buffers( &self ) -> Vec<Matrix>
No public source comment is attached to this declaration.
fn named_buffers( &self ) -> Vec<NamedBuffer>
No public source comment is attached to this declaration.
fn all_parameters( &self ) -> Result<Vec<Parameter>>
No public source comment is attached to this declaration.
fn all_named_parameters( &self ) -> Result<Vec<NamedParameter>>
No public source comment is attached to this declaration.
fn all_named_buffers( &self ) -> Result<Vec<NamedBuffer>>
No public source comment is attached to this declaration.
fn all_named_state_u32( &self ) -> Result<Vec<NamedStateU32>>
No public source comment is attached to this declaration.
fn num_parameters( &self ) -> Result<usize>
No public source comment is attached to this declaration.
fn train( &self, training: bool )
No public source comment is attached to this declaration.
fn eval( &self )
No public source comment is attached to this declaration.
fn is_training( &self ) -> bool
No public source comment is attached to this declaration.
fn scoped_eval( &self ) -> ScopedEval<'_>
No public source comment is attached to this declaration.
pub fn from_linear( linear: &Linear, quantization: Quantization ) -> Result<Self>
No public source comment is attached to this declaration.
pub fn from_quantized( weight: QuantMatrix, bias: Option<Matrix> ) -> Result<Self>
No public source comment is attached to this declaration.