Skip to content

Commit b77d0bf

Browse files
committed
fix: quantizer_error perCh changes
Signed-off-by: Brandon Groth <[email protected]>
1 parent b17a25e commit b77d0bf

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

tests/quantizers/test_quantizer_utils.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -238,17 +238,15 @@ def quantizer_error(
238238
diff = qtensor_fms_mo - qtensor_torch
239239
abs_diff = abs(diff)
240240
nonzero_diff_indices = abs_diff > max_norm_tol
241-
scale_diff_indices = (
242-
abs(abs_diff - scale) < 1e-3
243-
) # float epsilon distance required
241+
# float epsilon distance required
242+
scale_diff_indices = abs(abs_diff - scale) < 1e-3
244243
nonscale_nonzero_diff_indices = nonzero_diff_indices.logical_and(
245244
torch.logical_not(scale_diff_indices)
246245
)
247-
dtype_range = clip_high - clip_low
246+
dtype_range = clip_high.max() - clip_low.min()
248247
else:
249-
diff = qtensor_fms_mo.to(torch.int32) - qtensor_torch.to(
250-
torch.int32
251-
) # Cast uints to int32 to avoid negative number overflow
248+
# Cast uints to int32 to avoid negative number overflow
249+
diff = qtensor_fms_mo.to(torch.int32) - qtensor_torch.to(torch.int32)
252250
abs_diff = abs(diff)
253251
nonzero_diff_indices = abs_diff > 0
254252
scale_diff_indices = abs_diff == 1

0 commit comments

Comments
 (0)