Fix Bug where zero point isn't correct under entropy calibration (#13346)

### Description
Fix Bug where zero point isn't correct under entropy calibration 



### Motivation and Context
<!-- - Why is this change required? What problem does it solve?
- If it fixes an open issue, please link to the issue here. -->
This commit is contained in:
Jian Chen 2022-10-18 12:05:40 -04:00 committed by GitHub
parent 61ee5585b2
commit e3982416d3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -817,7 +817,12 @@ class HistogramCollector(CalibrationDataCollector):
min_kl_divergence_idx = np.argmin(kl_divergence)
optimal_threshold = thresholds[min_kl_divergence_idx]
min_value = histogram[2]
max_value = histogram[3]
if optimal_threshold[0] < min_value:
optimal_threshold = (min_value, optimal_threshold[1])
if optimal_threshold[1] > max_value:
optimal_threshold = (optimal_threshold[0], max_value)
return optimal_threshold