Quantifiable Layers and Constraints
This section lists the quantifiable layers available in different frameworks and their constraints.
- Layers that support uniform quantization and their constraints (Caffe)
Supported Layer Type
Constraints
Ascend IR–defined Layer
InnerProduct
transpose = false; axis = 1
FullyConnection
Convolution
filter is a 4D tensor.
Conv2D
Deconvolution
dilation is set to 1, and filter is a 4D tensor.
Deconvolution
Pooling
- If mode is set to 1 for full quantization (weight + tensor), and global_pooling is set to false, the shift-N operation is not supported.
- If mode is set to 0, only tensor quantization is performed.
Pooling
Eltwise
Only tensor quantization is performed and operation must be set to 1.
Eltwise
- Layers that support uniform quantization and their constraints (TensorFlow)
- Layers that support uniform quantization and their constraints (ONNX)
Weight-only quantization is supported only by the following product types:
Ascend IR–defined Layer |
Weight-Only Quantization: channel_wise = true in Weight ARQ |
Weight-Only Quantization: asymmetric in Weight ARQ (true/false) |
Weight and Activation Quantization: channel_wise = true in Weight ARQ |
Weight and Activation Quantization: asymmetric = true in Weight ARQ |
Constraints |
|---|---|---|---|---|---|
MatMulV2 |
√ |
true |
× |
× |
The sources of the second input must not contain dynamically variable nodes such as placeholders. |
BatchMatMulV2 |
√ |
true |
× |
× |
The sources of the second input must not contain dynamically variable nodes such as placeholders. |
FFN |
√ |
true and false |
× |
× |
|
Notes:
- √ indicates supported; × indicates that an exception occurs during quantization in this scenario.
- channel_wise = true in Weight ARQ indicates that each channel is quantized independently with distinct quantization factors.
- asymmetric in Weight ARQ
- true: Asymmetric quantization is applied for weight-only quantization.
- false: Symmetric quantization is applied for weight-only quantization.
- true and false indicate that symmetric quantization and asymmetric quantization are supported for weight-only quantization.