Forums - per-axis quantization

4 posts / 0 new
Last post
per-axis quantization
yakov.dan
Join Date: 5 May 20
Posts: 7
Posted: Thu, 2022-02-03 01:12

Hi,

I quantized a DLC using snpe-dlc-quantize with --axis_quant flag and without it. I got two different results, but no evidence of per-axis

quantization actually happening.  For instance, with axis_quant:


[INFO] Setting activation for layer:  StatefulPartitionedCall/model/expanded_conv_depthwise/depthwise and buffer: StatefulPartitionedCall/model/expanded_conv_depthwise_BN/FusedBatchNormV3:0
[INFO] bw: 8, min: -11.527022, max: 21.499841, delta: 0.129517, offset: -89.000000

without:

[INFO] Setting activation for layer: StatefulPartitionedCall/model/expanded_conv_depthwise/depthwise and buffer: StatefulPartitionedCall/model/expanded_conv_depthwise_BN/FusedBatchNormV3:0
[INFO] bw: 8, min: -13.750229, max: 25.646496, delta: 0.154497, offset: -89.000000

Clearly, min and max values are different. However, shouldn't there be [min, max] values per axis of the conv layer?

 

 

 

 

  • Up0
  • Down0
weihuan
Join Date: 12 Apr 20
Posts: 270
Posted: Thu, 2022-02-10 20:52

Dear customer,

What's SNPE version you have used? The option of --axis_quant is for per axis or channel quantization. That behavior will impact the final dlc encodings.

BR.

Wei

  • Up0
  • Down0
yakov.dan
Join Date: 5 May 20
Posts: 7
Posted: Sun, 2022-02-13 11:00

I've used SNPE version 1.59, the latest version at this time.

How can I see what are the min, max delta and offset values per axis of some layer? Is there a way to input the per-axis values manually?

Thanks

  • Up0
  • Down0
weihuan
Join Date: 12 Apr 20
Posts: 270
Posted: Thu, 2022-02-17 22:28

Dear customer,

SNPE supported the per-channel quantization. You can quantized the model with options of  --axis_quant

 [ --axis_quant ]      Use the --axis_quant option to select per-axis-element quantization for the weights and biases of certain layer types.
                        Currently only Convolution, Deconvolution and FullyConnected are supported.
 
You can review the encoding from dlc through tools of snpe-dlv-viewer.
 
At presents, the SNPE don't support to fill the encoding into dlc manually.
 
BR.
Wei
  • Up0
  • Down0
or Register

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.