QuantizedConv2DTranspose

class paddle.nn.quant.quant_layers. QuantizedConv2DTranspose ( layer: Layer, weight_bits: int = 8, activation_bits: int = 8, moving_rate: float = 0.9, weight_quantize_type: _QuantType = 'abs_max', activation_quantize_type: _QuantType = 'abs_max', weight_pre_layer: Layer | None = None, act_pre_layer: Layer | None = None, weight_quant_layer: Layer | None = None, act_quant_layer: Layer | None = None ) [source]

The computational logic of QuantizedConv2DTranspose is the same with Conv2DTranspose. The only difference is that its inputs are all fake quantized.

Examples

>>> import paddle
>>> import paddle.nn as nn
>>> from paddle.nn.quant.quant_layers import QuantizedConv2DTranspose

>>> x_var = paddle.uniform((2, 4, 8, 8), dtype='float32', min=-1., max=1.)
>>> conv = nn.Conv2DTranspose(4, 6, (3, 3))
>>> conv_quantized = QuantizedConv2DTranspose(conv)
>>> y_quantized = conv_quantized(x_var)
>>> y_var = conv(x_var)
>>> print(y_var.shape)
[2, 6, 10, 10]
>>> print(y_quantized.shape)
[2, 6, 10, 10]
forward ( input: Tensor, output_size: Size2 | None = None ) 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