Skip to main content

Module affine

Module affine 

Source
Expand description

Affine (scale + zero-point) integer quantization, shared by the INT8 and INT4 schemes – INT4 just runs this with bits: 4 and then nibble-packs the result (see crate::quant::pack4).

Structs§

AffineParams
Per-group affine quantization parameters: q = round(x / scale) + zero_point, clamped to the scheme’s [qmin, qmax].
QuantizedAffine
A tensor quantized with one AffineParams per group.

Functions§

dequantize_affine
Reconstructs f32 values from qvalues/params/groups produced by quantize_affine.
quantize_affine
Quantizes data (row-major, shape shape) to bits-bit signed integers at the given granularity, computing one AffineParams per group from that group’s own min/max.