fold col offset into bias; optimize A symmetric quant (#17026)
authorJongsoo Park <jongsoo@fb.com>
Thu, 4 Apr 2019 05:50:05 +0000 (22:50 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Thu, 4 Apr 2019 05:52:54 +0000 (22:52 -0700)
commitfa0ad057f8b0b16500a00ec874fcaa733e0287e3
tree89d77f81ba9ee1e7759d7a2f48daf9ce963d1f22
parent72913a55a8d913b2d1330a8c58159257542f7628
fold col offset into bias; optimize A symmetric quant (#17026)

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

D14013931 was for FC. This diff is similar optimizations for Conv.
A subtle difference is that in FC, once we fold col_offset into bias during pre-processing step, we can treat everything as if A_zero_offset == 0 (symmetric quantization of A).
In Conv, we can't do this because padding still needs to use the original A_zero_offset.
From requantization point of view, once col_offset folded into bias, we can treat as if we're doing symmetric A quantization.
But, for steps involving padding like im2col, im2col fused with packing, and direct conv for depth-wise/group convolution we still need to pass the original A_zero_offset.

Reviewed By: jianyuh

Differential Revision: D14020276

fbshipit-source-id: c29caefd1127bbc6aff0e9d535939bb0c1ecb66c
caffe2/quantization/server/conv_dnnlowp_acc16_op.cc
caffe2/quantization/server/conv_dnnlowp_acc16_op.h
caffe2/quantization/server/conv_dnnlowp_op.cc
caffe2/quantization/server/conv_dnnlowp_op.h