SqnrEncodingAnalyzer
- class aimet_torch.v2.quantization.encoding_analyzer.SqnrEncodingAnalyzer(shape, num_bins=2048, *, asymmetric_delta_candidates=17, symmetric_delta_candidates=101, offset_candidates=21, max_parallelism=64, gamma=3.0)[source]
Encoding Analyzer for SQNR Calibration technique
- Parameters:
shape (
tuple
) – Shape of calculated encodingnum_bins (
int
) – number of bins to use per histogramasymmetric_delta_candidates – number of delta values to search over in asymmetric mode
symmetric_delta_candidates – number of delta values to search over in symmetric mode
offset_candidates – number of offset values to search over in asymmetric mode
max_parallelism – maximum number of encodings to process parallely (higher number results in higher memory usage but faster computation)
gamma – weighting factor on clipping noise (higher value results in less clipping noise)
- compute_encodings_from_stats(stats, num_steps, is_symmetric)[source]
Searches for encodings which produce the lowest expected SQNR based on the histograms in stats
- Parameters:
stats (
List
[_Histogram
]) – A list of _Histogram objects with length equal to the number of encodings to computenum_steps (
int
) – The number of bins the quantized range is split intois_symmetric (
bool
) – If True, computes symmetric encodings, else computes asymmetric encodings
- Return type:
Tuple
[Optional
[Tensor
],Optional
[Tensor
]]- Returns:
Tuple of computed encodings (min, max) as tensors with shape self.shape