flashinfer.quantization.encode_csf_scales¶
- flashinfer.quantization.encode_csf_scales(scales: Tensor) CsfScales¶
Compress block-scale matrices into CSF slabs.
A row’s base is the lowest start among the 16-value windows that cover the most of its bytes, the rule of CSF checkpoints, so encoding a checkpoint’s decoded scales gives back its
nvfp4_csf_fixedandnvfp4_csf_exceptionsstreams.- Parameters:
scales (torch.Tensor) – Contiguous CUDA
[rows, cols]or[num_matrices, rows, cols]block scales in a one-byte dtype such asfloat8_e4m3fn, withrowsa multiple of 16,colseven androws * cols <= 2**24.- Returns:
The compressed scales. Sizing the exceptions reads their count back to the host, so encoding cannot run under CUDA graph capture.
- Return type:
CsfScales