return ChooseQuantizationParams(min, max, precision, preserve_sparsity);
}
- Histogram hist(2048, min, max);
+ /** Ajust the granularity of histogram collection to
+ * the quantization precision. Use 8x more number of bins
+ * in the histogram should be sufficient for linear quantization.
+ */
+ Histogram hist(1 << (precision + 3), min, max);
for (int i = 0; i < len; ++i) {
hist.Add(values[i]);
}
actual = OutputTensorCPU_(0)->template data<float>();
} else {
actual_temp.resize(OutputTensorCPU_(0)->numel());
- fbgemm::Dequantize<float>(
- OutputTensorCPU_(0)->template data<float>(),
+ fbgemm::Dequantize<T>(
+ OutputTensorCPU_(0)->template data<T>(),
actual_temp.data(),
OutputTensorCPU_(0)->numel(),
out_qparams_);