amend D14778810 (#18902)
authorSummer Deng <summerdeng@fb.com>
Wed, 10 Apr 2019 04:59:33 +0000 (21:59 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Wed, 10 Apr 2019 05:08:54 +0000 (22:08 -0700)
commit496b0b03d988ccdb242f8674f1c5e176f2bef221
tree885eba1f1ca4ee5c6cb2c71125d2a4dbaff63221
parent82b570528db0a43fc04bb90f5d4538c01e4a5582
amend D14778810 (#18902)

Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/18902

Fix in D14778810 had an issue that when we fallback to acc32 because the density of outlier is too high W_quantized_ is already modified. In this diff we first just count the number of outliers (without modifying W_quantized_) and only when density is low enough and no need for fallback we modify W_quantized_ and construct an outlier matrix.

Reviewed By: jspark1105

Differential Revision: D14785256

fbshipit-source-id: 03933110a4ca7409686a06b18a9bb921f8657950
caffe2/quantization/server/conv_dnnlowp_acc16_op.cc
caffe2/quantization/server/conv_dnnlowp_acc16_op_test.py
caffe2/quantization/server/conv_groupwise_dnnlowp_acc16_op_test.py
caffe2/quantization/server/fbgemm_pack_op.cc
caffe2/quantization/server/fbgemm_pack_op.h