-
Notifications
You must be signed in to change notification settings - Fork 928
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FEA] Refactor isclose tests. #10284
Comments
This issue has been labeled |
This issue has been labeled |
I'm going to close this in favor of #13593 |
Is your feature request related to a problem? Please describe.
In PR #10203, we discovered there is a pytest parametrization for
isclose
that is 6x6x6x6 = 1296 tests. #10203 (comment)We can minimize the number of test cases dramatically while improving our test coverage.
Describe the solution you'd like
We want to cover all of the following cases for "low precision" (1e-5 or more, for unit scale data) and "high precision" (1e-8 or less, for unit-scale data):
We can parametrize these in a few (4-6) sets of parameters that provide both data and tolerances, instead of the full matrix of all data and tolerance combinations.
Additional context
isclose
is not commutative betweena
andb
. The formula forisclose(a, b, rtol, atol)
isabsolute(a - b) <= (atol + rtol * absolute(b))
.isclose
often deal with comparing "small" differences, often at a precision greater than can be represented in a float32. That is, comparisons of1.00000001
and1
.np.float32(1.00000001) == 1
(indistinguishable float32 representations) butnot np.isclose(1.00000001, 1, rtol=1e-10, atol=1e-10)
(these values may be considered non-equal and not-close at some higher precision).The text was updated successfully, but these errors were encountered: