nvflare.app_opt.pt.quantization.ada_quant module

class AdaQuantizer(weight: float = 0.01, compression: bool = True)[source]

Bases: object

Implements the ADAQUANT quantization scheme,

for further details refer to the paper https://arxiv.org/abs/2208.05174

Parameters:
  • weight – a hyperparameter for the trade-off between quantization size and error

  • compression – whether to compress the resulting integer quantized tensor

dequantized(quantized_tensor: Tensor, quant_state: dict) Tensor[source]
get_number_of_quantization_levels(element_size: int, values_tensor: Tensor) tuple[float, int, Any] | None[source]
get_offset(tensor: Tensor) float[source]
quantize(values_tensor: Tensor) tuple[Tensor | ndarray, dict][source]