mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 12:20:52 +01:00
[fbgemm] fix bug handling bias in rowwise quantization of FC (#58022)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/58022 Caffe2 Int8FC + rowwise quantization was not handling bias correctly. Test Plan: The example in D28347336 doesn't show bigger error with rowwise quantization any more Reviewed By: hx89, janeyx99 Differential Revision: D28347336 fbshipit-source-id: 3ac95fd2f29ef6e52705c3a2361b605813c2bcc5
This commit is contained in:
parent
3e46d6c9e4
commit
dc55ab3f77
|
|
@ -815,7 +815,8 @@ bool FullyConnectedDNNLowPOp<T, ReluFused>::GetQuantizationParameters_() {
|
|||
b_dequantized_.resize(N);
|
||||
for (int j = 0; j < N; ++j) {
|
||||
b_dequantized_[j] = fbgemm::Dequantize<int32_t>(
|
||||
b_quantized_data_[j], in_qparams_[2]);
|
||||
b_quantized_data_[j],
|
||||
filter_qparams_[quantize_channelwise_ ? j : 0]);
|
||||
}
|
||||
b_dequantized_data_ = b_dequantized_.data();
|
||||
}
|
||||
|
|
@ -827,7 +828,8 @@ bool FullyConnectedDNNLowPOp<T, ReluFused>::GetQuantizationParameters_() {
|
|||
(*b_quantized_)[j] = fbgemm::Quantize<int32_t>(
|
||||
b_dequantized_data_[j],
|
||||
0,
|
||||
in_qparams_[0].scale * filter_qparams_[0].scale,
|
||||
in_qparams_[0].scale *
|
||||
filter_qparams_[quantize_channelwise_ ? j : 0].scale,
|
||||
32);
|
||||
}
|
||||
b_quantized_data_ = b_quantized_->data();
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user