Skip to content

Commit

Permalink
verif: Return fail code instead of success
Browse files Browse the repository at this point in the history
  • Loading branch information
fischeti committed Feb 15, 2024
1 parent 3a7d231 commit a6fb6bc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions util/sim/data_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,13 +227,13 @@ def check_result(expected, actual, atol=None, rtol=None):
if atol is not None and rtol is not None:
raise ValueError('atol and rtol are mutually exclusive.')
if atol is not None:
fail = np.allclose(expected, actual, atol=atol, equal_nan=False)
success = np.allclose(expected, actual, atol=atol, equal_nan=False)
error = np.abs(expected - actual)
elif rtol is not None:
fail = np.allclose(expected, actual, rtol=rtol, equal_nan=False)
success = np.allclose(expected, actual, rtol=rtol, equal_nan=False)
scale = np.maximum(np.abs(expected), np.abs(actual))
scale[scale == 0] = 1 # Avoid division by zero, use absolute tolerance instead
error = np.abs(expected - actual) / scale
else:
raise ValueError('Either atol or rtol must be specified.')
return fail, error
return not success, error

0 comments on commit a6fb6bc

Please sign in to comment.