File tree Expand file tree Collapse file tree 1 file changed +5
-7
lines changed
Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments