Skip to main content

compute_groups

Function compute_groups 

Source
pub fn compute_groups(
    shape: &[usize],
    granularity: Granularity,
) -> (Vec<u32>, usize)
Expand description

Computes the flat-index -> group-id table for a tensor of shape under granularity, and the resulting group count. Quantizing functions in this module compute and use this internally; it’s exposed so callers reconstructing a quantized tensor (e.g. crate::validate, or an external consumer of teeny-quant’s output) can recompute the same element -> group mapping without duplicating the grouping logic.