-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
TST: stats.ttest_1samp: fix xslow test #20642
Conversation
scipy/stats/tests/test_stats.py
Outdated
data = data.astype(np.float64, copy=True) # ensure byte order | ||
data = xp.asarray(data, dtype=xp.float64) |
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.
data = data.astype(np.float64, copy=True) # ensure byte order | |
data = xp.asarray(data, dtype=xp.float64) | |
data = data.astype(np.float64, copy=True) # ensure byte order | |
# `float64` is needed here because of the range of `alpha` | |
data = xp.asarray(data, dtype=xp.float64) |
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.
I did check that all these incantations pass locally on x86_64 Linux, while they fail on main
:
SCIPY_XSLOW=1 SCIPY_DEVICE=cuda python dev.py test -j 32 -b all -- -k "test_pvalue_ci"
SCIPY_XSLOW=1 python dev.py test -j 32 -b all -- -k "test_pvalue_ci"
SCIPY_XSLOW=1 python dev.py test -j 32 -- -k "test_pvalue_ci"
I tried to play picky reviewer and force float32
instead of float64
locally, and saw overflow/invalid value warnings, so that seems like a plausible justification for non-stats
expert at least.
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.
(obivously the first one has limited value, since it is cpu only)
@lucascolley, I've only been following the array API project peripherally, so I don't think I'll dig into it now to review this. I hope all reviewers of PRs that touch XSLOW tests will be sure to run the tests themselves to ensure all is working as expected before merging. Alternatively (or additionally), perhaps the CI gurus could add a CI job that runs the XSLOW tests when a flag such as |
scipy/stats/tests/test_stats.py
Outdated
data = data.astype(np.float64, copy=True) # ensure byte order | ||
data = xp.asarray(data, dtype=xp.float64) |
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.
Am I missing something with the "ensure byte order" comment? Can we not just include the copy
in asarray
?
data = data.astype(np.float64, copy=True) # ensure byte order | |
data = xp.asarray(data, dtype=xp.float64) | |
# `float64` is needed here because of the range of `alpha` | |
data = xp.asarray(data, dtype=xp.float64, copy=True) |
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.
hypothesis
generates them in some nonstandard format that torch.asarray
won't accept. Might be possible to make it generate more standard float64
s.
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.
okay, if that isn't possible then I think this looks okay. Maybe worth adding a comment as to why.
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.
I adjusted the test strategy to generate normal float64
s. I think that the old strategy must have been left over from before the test took its final form.
I tested locally again and things were still "good" so I merged it. I think the comments were addressed for the small patch here. |
Reference issue
Closes gh-20641
What does this implement/fix?
Fixes the one test failure that occurs twice with each backend tested.
Additional information