Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you know why the tensor size would be 0?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

initializer of some ops could be empty, for example Resize op:
image

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