-
Notifications
You must be signed in to change notification settings - Fork 913
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
Fix scipy.special.logsumexp
type promotion, test against NumPy and SciPy nightlies
#643
Conversation
The great thing here is that the previous failing test for PyPy 3.9 on Windows does not fail anymore, because the NumPy development version available on https://anaconda.org/scientific-python-nightly-wheels/numpy/files does not support PyPy 3.9 anymore (so, it fails beforehand when installing). The PyPy 3.10 on Windows tests pass, as expected. I think what's left to do here is to add some logic to determine when to run the nightly tests and to skip them if a wheel is not available for the desired Python implementation + version duo. This might require a bit of hacking and setting up a dynamic GHA matrix with some JSON – I should be able to figure that out. |
Hey @agriyakhetarpal, sorry I got a bit lost and am trying to catch up. I had a look at the failing windows pypy test and this looks quite odd to me. To me it is still not clear to which degree we need to explicitly ensure that the code is also working properly with pypy considering the additional maintenance cost that comes with it. From my perspective it would probably be more valueable to focus on potential issues with future CPython and NumPy versions so I appreciate your work towards nightly tests. Is there any explict input you need for this PR? |
Thanks for offering to see through this, @fjosw! As discussed on 14/10/2024, I'll rework this PR to make it simpler. Putting the plan out in public here:
I'll split out the second and third points into their own, separate PRs. We should be good to go with this PR once I address the first point! |
The |
scipy.special.logsumexp
type promotion, test against NumPy and SciPy nightlies
I fixed the tests, and all of them are passing now! Two things I observed:
The combination of both of these things can sometimes restrict debugging (or so I had the experience of) when fixing the failing test – I had to check multiple angles (fwd vs rev modes, randn, keepdims set to True vs False, combo_check) before arriving to a conclusion. If we were to deprecate the Would something like this be a reasonable proposition? |
I agree with this idea. Presumably we should be able to get roughly equivalent tests using pytest parameterized tests. If you do implement this it might be worth checking that it doesn't slow the tests down (I like the fact that our tests are really fast).
This might be from an error occurring during the backward pass of reverse-mode autodiff. When an error occurs during the backward pass you can't get a traceback to the corresponding point in user code. It might be something else though - feel free to paste an example if you hit this again and I can look into it. |
Yes, I do think it won't slow the tests down, but OTOH, it would actually make them faster by a bit – right now, the
Will do! I shall open a separate issue for this right now, though one example is the reverse mode case for Thank you for the review! |
This change is as discussed between Jamie, Fabian and me; and subsequently posted publicly in #643 (comment). Pinning to NumPy <= 2.3 would also be an ideal option, but we have opted for a more relaxed pin to NumPy <3, owing to the fact that we have limited availability to add new features and hence fewer chances of anything major breaking. This change is being merged after #643, and has been split from it because it is not directly related to the proposition of adding tests against nightly dependencies.
This PR enables testing against NumPy and SciPy nightlies, which were added in #632 and later disabled to be split out here. I've also fixed a test relating to incorrect shapes being cast (scalars were not being treated as arrays) within the
combo_check
function, so all tests should now pass on nightly and stable versions.Related to #630