FakeQuantMovingAverageAbsMax

class paddle.nn.quant.quant_layers. FakeQuantMovingAverageAbsMax ( name=None, moving_rate=0.9, quant_bits=8, dtype='float32', reduce_type=None ) [source]

FakeQuantMovingAverageAbsMax layer does the moving_average_abs_max quant and then dequant. Its computational formula is described as below:

\(scale = (moving\_rate*accum+max(abs(x)))/(moving\_rate*state+1)\) \(range = 2^{bit\_length - 1} - 1\) \(Out = round(X / scale * range) * scale / range\)

forward ( input )

forward

Defines the computation performed at every call. Should be overridden by all subclasses.

Parameters
  • *inputs (tuple) – unpacked tuple arguments

  • **kwargs (dict) – unpacked dict arguments