QLinear
QLinear(in_features, out_features, bias=True, device=None, dtype=None, *, activation=None)
Static-quant linear: quantized weight AND quantized activations; the
forward returns floating point, or a quantized tensor once an output
requant is bound with :meth:set_output_quantization.
Args:
in_features: the size of each input sample.
out_features: the size of each output sample.
bias: declare the bias slot (an integer bias adds in the integer
accumulator; a floating-point bias in the real domain).
device: where the layer's tensors live; None declares on the
cpu.
dtype: the layer's logical dtype; None adopts the bound
payload's.
activation: a fused epilogue applied to every output (a name such
as "relu" or an :class:~clika_runtime.Activation value);
None for none.
__init__
__init__(self, in_features: 'int', out_features: 'int', bias: 'bool' = True, device: 'Device | str | None' = None, dtype: 'DtypeLike | None' = None, *, activation: 'ActivationLike' = None) -> 'None'
Initialize self. See help(type(self)) for accurate signature.
extra_repr
extra_repr(self) -> 'str'
extra_repr() -> str
One line of per-class detail for :meth:__repr__; a layer prints
its geometry here (in_features=64, out_features=256).
forward
forward(self, input: 'QTensor') -> 'Tensor'
forward(input) -> Tensor
Quantized [*, in_features] activations to [*, out_features]
(floating point, or quantized once an output requant is bound).
from_weights
from_weightsfrom_weights(weight, bias=None, *, activation=None) -> QLinear
from_weights(weight, bias=None, *, activation=None) -> QLinear
Construct FROM a quantized weight: geometry, dtype, and device read
off the payload; an optional bias binds beside it.
set_output_quantization
set_output_quantization(self, scale: 'Tensor', zero_point: 'Tensor | None' = None, *, quant_axis: 'int' = -1, out_dtype: 'DtypeLike | None' = None) -> 'None'
set_output_quantization(scale, zero_point=None, *, quant_axis=-1, out_dtype=None) -> None
Bind the output requant: the forward then returns a quantized tensor at the bound scheme. Never calling it keeps the floating-point output path.
set_weights
set_weights(self, weight: 'QTensor', bias: 'Tensor | None' = None) -> 'None'
set_weights(weight, bias=None) -> None
Bind the quantized weight and the optional bias; a dense weight is refused.