File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -558,7 +558,7 @@ def _test_model_inference(
558558 )
559559 mismatched_elements = mismatched .sum ().item ()
560560 if mismatched_elements / expected .size > mismatched_tol / 1e6 :
561- r_max_idx = (r_diff := abs_diff / abs (expected )).argmax ()
561+ r_max_idx = (r_diff := abs_diff / ( abs (expected ) + 1e-6 )).argmax ()
562562 r_max = r_diff [r_max_idx ].item ()
563563 r_actual = actual [r_max_idx ].item ()
564564 r_expected = expected [r_max_idx ].item ()
@@ -570,7 +570,7 @@ def _test_model_inference(
570570 f"Output '{ m } ' disagrees with { mismatched_elements } of"
571571 + f" { expected .size } expected values."
572572 + f"\n Max relative difference: { r_max :.2e} "
573- + rf" (= \|{ r_actual :.2e} - { r_expected :.2e} \|/\|{ r_expected :.2e} \ |)"
573+ + rf" (= \|{ r_actual :.2e} - { r_expected :.2e} \|/\|{ r_expected :.2e} + 1e-6 |)"
574574 + f" at { r_max_idx } "
575575 + f"\n Max absolute difference: { a_max :.2e} "
576576 + rf" (= \|{ a_actual :.2e} - { a_expected :.2e} \|) at { a_max_idx } "
You can’t perform that action at this time.
0 commit comments