QuantConv2d¶
Bases: QuantBase
Int8-quantized 2-D convolution with optional BatchNorm and ReLU.
When bn=True a :class:torch.nn.BatchNorm2d is applied after the
convolution during training; for schema export BN is folded into the
weight and bias.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
in_channels
|
int
|
Number of input channels. |
required |
out_channels
|
int
|
Number of output channels. |
required |
kernel_size
|
int | tuple[int, int]
|
Kernel size. |
required |
stride
|
int | tuple[int, int]
|
Convolution stride. |
1
|
padding
|
int | tuple[int, int] | tuple[int, int, int, int]
|
Zero-padding. |
0
|
bias
|
bool
|
Whether to include an additive bias. |
True
|
device
|
str
|
Torch device for the underlying parameters. |
'cpu'
|
act_func
|
str | None
|
Either |
None
|
ema_constant
|
float
|
EMA smoothing factor for observers. |
0.01
|
bn
|
bool
|
If |
False
|