-
-
Notifications
You must be signed in to change notification settings - Fork 11.1k
TST: Add tests for FP16 umath functions #21954
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
Conversation
arr = np.arange(65536, dtype=np.int16) | ||
datafp16 = np.frombuffer(arr.tobytes(), dtype=np.float16) | ||
datafp32 = datafp16.astype(np.float32) | ||
assert_array_max_ulp(ufunc(datafp16), ufunc(datafp32), maxulp=1, dtype=np.float16) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
linting
assert_array_max_ulp(ufunc(datafp16), ufunc(datafp32), maxulp=1, dtype=np.float16) | |
assert_array_max_ulp( | |
ufunc(datafp16), ufunc(datafp32), maxulp=1, dtype=np.float16) |
There is a failing test in cygwin. |
1e4da8f
to
2fa2e2e
Compare
for value in [np.inf, -np.inf]: | ||
for dt in ['e', 'f', 'd']: | ||
assert_raises(FloatingPointError, callable, | ||
np.array([value], dtype=dt)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you refactor this as a parameterized test?
np.log2(arr) | ||
np.log10(arr) | ||
np.arccosh(arr) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you refactor this into a parameterized test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. These tests need a good refactoring, this might be a nice task for a sprint. I noted two that it might be nice to fix already in this PR, if you have time.
Thanks @r-devulap |
Adding tests for comprehensive coverage of float16 umath functions.