Skip to content

stdlib/quantView source ↗

quant

4 items · generated by scribe fromstdlib/quant.fd· synced 2026-11-15

stdlib/quant4 items

Contents

quantize_q8

Quantize a float tensor to q8 (int8 with scale and zero_point). Each value is clamped to [-128, 127] after scaling.

pub fn quantize_q8(t: Tensor, scale: f64, zero_point: i64) -> Tensor {

Parameters:

  • t: Tensor
  • scale: f64
  • zero_point: i64

Returns: Tensor

Defined at line 15


dequantize_q8

Dequantize a q8 tensor back to f32.

pub fn dequantize_q8(t: Tensor, scale: f64, zero_point: i64) -> Tensor {

Parameters:

  • t: Tensor
  • scale: f64
  • zero_point: i64

Returns: Tensor

Defined at line 20


qmatmul

Quantized matmul: q8 × q8 → f32 On x86 with VNNI: uses VPDPBUSD instruction On ARM with dotprod: uses SDOT/UDOT instructions On GPU: uses INT8 matrix multiply On unsupported hardware: dequantizes, computes, returns f32

pub fn qmatmul(a: Tensor, b: Tensor) -> Tensor {

Parameters:

  • a: Tensor
  • b: Tensor

Returns: Tensor

Defined at line 29


find_quant_params

Per-tensor quantization: find optimal scale and zero_point. Returns “scale,zero_point” as a string.

pub fn find_quant_params(t: Tensor) -> str {

Parameters:

  • t: Tensor

Returns: str

Defined at line 35


Generated by scribe, the Fides documentation generator