HistogramObserver

class HistogramObserver(bins=2048, upsample_rate=128, mode=QuantMode.SYMMERTIC, eps=1e-05, dtype='qint8', **kwargs)[源代码]

A MinMaxObserver using running histogram of tensor values for min/max updating. Usually used for calibration quantization.

参数
  • bins (int) – number of bins to use for the histogram.

  • upsample_rate (int) – which ratio to interpolate histograms in.

  • mode (QuantMode) – set quantization mode.

  • eps (float) – a initial maximum value to avoid division by zero problem.

  • dtype (Union[str, QuantDtypeMeta]) – 字符串,表明按何种dtype来收集scale和zero_point。