Skip to main content

QConv

Static-quant channels-last convolution: quantized weight AND quantized activations; forward returns float, or a quantized tensor once an output requant is bound.

__init__

__init__(self, in_channels: 'int', out_channels: 'int', kernel: 'Sequence[int]', stride: 'Sequence[int]' = (), padding: 'Sequence[int]' = (), dilation: 'Sequence[int]' = (), groups: 'int' = 1, bias: 'bool' = False, *, mode: 'PadMode' = PadMode.Constant, value: 'float | None' = None, activation: 'Activation | None' = None, dtype: 'DataType' = DataType.Float32, device: 'Device | None' = None) -> 'None'

Declare the slots; same knob contract as :class:Conv.

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.

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 and the optional bias (an integer bias adds in the integer accumulator; a float bias in the real domain).