Skip to content

Commit

Permalink
Properly deal with NaNs when comparing sparse and dense matrices
Browse files Browse the repository at this point in the history
  • Loading branch information
robomics committed Oct 15, 2024
1 parent ee1f1c6 commit fef0d45
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions test/scripts/fuzzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ def compare_numpy(
)
return False

num_differences = (~np.isclose(expected, found, rtol=rtol)).sum()
num_differences = (~np.isclose(expected, found, rtol=rtol, equal_nan=True)).sum()
if num_differences != 0:
logging.warning(
"[%d] %s, %s (%d nnz): FAIL! Found %d differences!",
Expand Down Expand Up @@ -333,7 +333,7 @@ def compare_csr(
)
return False

num_differences = (~np.isclose(expected.data, found.data, rtol=rtol)).sum()
num_differences = (~np.isclose(expected.data, found.data, rtol=rtol, equal_nan=True)).sum()
if num_differences != 0:
logging.warning(
"[%d] %s, %s (%d nnz): FAIL! Found %d differences!",
Expand Down

0 comments on commit fef0d45

Please sign in to comment.