Skip to content

Commit

Permalink
Fix onnxrt calibration issue (#1666)
Browse files Browse the repository at this point in the history
Signed-off-by: Mengni Wang <[email protected]>
  • Loading branch information
mengniwang95 authored Mar 14, 2024
1 parent 01d966b commit cd6d244
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions neural_compressor/adaptor/ox_utils/calibration.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,8 +440,9 @@ def get_weight_tensors_calib_range(self):
),
)
calibrator = CALIBRATOR["minmax"]() # use minmax method to calibrate initializer tensors
calibrator.collect(initializer_tensor)
weight_tensors_calib_range[initializer_tensor_name] = [list(calibrator.calib_range)]
if initializer_tensor.flatten().size > 0:
calibrator.collect(initializer_tensor)
weight_tensors_calib_range[initializer_tensor_name] = [list(calibrator.calib_range)]
calibrator.clear()
del calibrator
return weight_tensors_calib_range
Expand Down

0 comments on commit cd6d244

Please sign in to comment.