FakeQuantAbsMax

class paddle.nn.quant.quant_layers. FakeQuantAbsMax ( name=None, quant_bits=8, dtype='float32', quant_on_weight=False ) [source]

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

\(scale = max(abs(X))\) \(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