Skip to main content

QLinear

Static-quant linear: quantized weight AND quantized activations; forward returns float, or a quantized tensor once an output requant is bound via :meth:set_output_quantization.

__init__

__init__(self, in_features: 'int', out_features: 'int', bias: 'bool' = False, *, activation: 'Activation | None' = None) -> 'None'

Declare the slots (canonical [out_features, in_features] HF orientation).

extra_repr

extra_repr(self) -> 'str'

One line of per-class detail for :meth:__repr__ (a layer prints its geometry here).

forward

forward(self, x: 'QTensor') -> 'Tensor'

Subclasses define the computation here; call the module itself (m(x)), not forward directly.

from_weights

from_weightsConstruct FROM a quantized weight: geometry, dtype, and device

Construct FROM a quantized weight: geometry, dtype, and device read off the payload (an integer bias adds in the integer accumulator; a float bias in the real domain).

set_output_quantization

set_output_quantization(self, scale: 'Tensor', zero_point: 'Tensor | None' = None, *, quant_axis: 'int' = -1, out_dtype: 'DataType | None' = None) -> 'None'

Bind the output requant: forward then returns a quantized tensor at the bound scheme.

set_weights

set_weights(self, weight: 'QTensor', bias: 'Tensor | None' = None) -> 'None'

Bind the quantized weight; a dense weight is refused.