Expand description
Core quantization logic for INT8 and INT4.
Provides tensor-level quantization (per-tensor and per-channel),
INT4 bit-packing, and the high-level Quantizer that combines
a QuantConfig with optional calibration statistics.
Structs§
- Int4
Range - Marker for INT4 quantization (
-8 … 7). - Int8
Range - Marker for INT8 quantization (
-128 … 127). - Quant
Config - Configuration for a quantization pass.
- Quant
Params Generic - Affine quantization parameters (scale and zero-point), generic over bit-width.
- Quantized
Tensor Generic - Generic quantized tensor, parameterized by bit-width marker.
- Quantizer
- High-level quantizer that combines configuration with optional calibration.
Enums§
- Quantized
Tensor Type - Type-erased wrapper over
QuantizedTensor(INT8) andQuantizedTensorInt4(INT4).
Traits§
- Quant
Range - Marker trait that supplies the clamp constants for a quantization bit-width.
Functions§
- pack_
int4 - Pack a slice of INT4 values (two per byte, high nibble first).
- unpack_
int4 - Unpack INT4 values from packed bytes, returning exactly
num_valuesi8s.
Type Aliases§
- Quant
Params - INT8 affine quantization parameters —
clamp(-128, 127). - Quant
Params Int4 - INT4 affine quantization parameters —
clamp(-8, 7). - Quantized
Tensor - An INT8 quantized tensor with optional per-channel parameters.
- Quantized
Tensor Int4 - An INT4 quantized tensor with optional per-channel parameters and bit packing.