Skip to content

Commit

Permalink
Relaxed tolerance for cumultivae_logsumexp closed form test
Browse files Browse the repository at this point in the history
Made failure more informative
  • Loading branch information
oleksandr-pavlyk committed Mar 30, 2024
1 parent 3395d05 commit b88f8ee
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions dpctl/tests/test_tensor_accumulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,5 +408,12 @@ def test_cumulative_logsumexp_closed_form(fpdt):
r = dpt.cumulative_logsumexp(dpt.arange(-n, 0, dtype=fpdt, device=q))
expected = geometric_series_closed_form(n, dtype=fpdt, device=q)

tol = 4 * dpt.finfo(fpdt).eps
assert dpt.allclose(r, expected, atol=tol, rtol=tol)
tol = 32 * dpt.finfo(fpdt).eps
if not dpt.allclose(r, expected, atol=tol, rtol=tol):
ad = dpt.abs(r - expected)
max = dpt.max(ad)
viols = ad > tol + tol * dpt.maximum(dpt.abs(r), dpt.abs(expected))
viols_count = dpt.sum(viols)
assert (
False
), f"allclose failed, absdiff = {max}, violations = {viols_count}"

0 comments on commit b88f8ee

Please sign in to comment.