Skip to main content

LinearOps

Trait LinearOps 

Source
pub trait LinearOps: Send + Sync {
    // Required method
    fn linear(&self, input: &TensorRef, weight: &TensorRef) -> Result<TensorRef>;

    // Provided method
    fn quantized_linear(
        &self,
        _input: &TensorRef,
        _packed_weight: &TensorRef,
        _scheme: &QuantScheme,
    ) -> Result<TensorRef> { ... }
}
Expand description

Linear / matrix-multiply operations.

Required Methods§

Source

fn linear(&self, input: &TensorRef, weight: &TensorRef) -> Result<TensorRef>

Dense linear projection (no bias): input @ weight^T.

  • input[..., in_features]
  • weight[out_features, in_features]

Provided Methods§

Source

fn quantized_linear( &self, _input: &TensorRef, _packed_weight: &TensorRef, _scheme: &QuantScheme, ) -> Result<TensorRef>

Quantized linear projection.

packed_weight is backend-specific packed data (e.g. Q4_0 blocks).

Implementors§