FakeQuantAbsMax¶
- class paddle.nn.quant.quant_layers. FakeQuantAbsMax ( name: str | None = None, quant_bits: int = 8, dtype: DTypeLike = 'float32', quant_on_weight: bool = False, reduce_type: Literal[max] | None = None ) [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: Tensor
)
Tensor
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
-
forward
(
input: Tensor
)
Tensor