TST: Add tests for FP16 umath functions#21954
Merged
mattip merged 2 commits intonumpy:mainfrom Aug 4, 2022
Merged
Conversation
mattip
reviewed
Jul 9, 2022
| 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) |
Member
There was a problem hiding this comment.
linting
Suggested change
| 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) |
Member
|
There is a failing test in cygwin. |
1e4da8f to
2fa2e2e
Compare
mattip
reviewed
Jul 31, 2022
| for value in [np.inf, -np.inf]: | ||
| for dt in ['e', 'f', 'd']: | ||
| assert_raises(FloatingPointError, callable, | ||
| np.array([value], dtype=dt)) |
Member
There was a problem hiding this comment.
Could you refactor this as a parameterized test?
mattip
reviewed
Jul 31, 2022
| np.log2(arr) | ||
| np.log10(arr) | ||
| np.arccosh(arr) | ||
|
|
Member
There was a problem hiding this comment.
Could you refactor this into a parameterized test
mattip
approved these changes
Jul 31, 2022
Member
mattip
left a comment
There was a problem hiding this comment.
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.
Member
|
Thanks @r-devulap |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adding tests for comprehensive coverage of float16 umath functions.