Groups are formed along axis 0 (the input/contracting dimension).
Each group of block_size rows gets its own scale factor and zero point
per column. This is useful for weight distributions that are not centered
around zero.
Args
inputs
Input tensor to quantize. Shape: (input_dim, output_dim).
block_size
Number of elements per group along axis 0.
value_range
Tuple of (min, max) quantization range.
dtype
Data type of quantized output.
epsilon
Small value to avoid division by zero.
to_numpy
Whether to perform computation in numpy for memory
efficiency.
Returns
A tuple (quantized_tensor, scale, zero_point) where:
quantized_tensor: Same shape as inputs, dtype=dtype.
scale: Shape (n_groups, output_dim) where
n_groups = ceil(input_dim / block_size).
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2026-10-31 UTC."],[],[]]