-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
MAINT, TST: NumPy stride deprecation shim #23199
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
@@ -1295,7 +1295,7 @@ def test_odd_strides(self, xp): | |||
# us into wrong memory if used (but it does not need to be used) | |||
dummy = xp.arange(10, dtype=xp.float64) | |||
a = dummy[5:6] | |||
a.strides = 16 | |||
a = xp.lib.stride_tricks.as_strided(a) |
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 don't know if using xp
here contributes that much--pretty sure the stride trick stuff can't be part of the array API standard anyway.
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 should probably set the value to 16
though...
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.
xp.asarray(np.stride_tricks.as_strided(np.asarray(a),...)))
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.
Or make the test numpy-only via @skip_xp_baxkends(np_only=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.
it is also NumPy-only in the decorator I think, unless you're thinking of farther into the future (although some array API backends still don't propagate the strides do they?)
* This patch allows the SciPy testsuite to pass against NumPy `main` branch, after numpy/numpy#28925 was merged in the last day or so.
1242ade
to
3e40b21
Compare
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.
thanks Tyler, LGTM now that strides=(16,)
is here!
note that this patch causes a failure on the maintenance branch when backported: https://github.com/scipy/scipy/actions/runs/15788333092/job/44509424585?pr=23188 The array API stuff and its deps are pretty tricky to handle portably on both branches.. |
thanks Tyler |
main
branch, after DEP: Deprecate setting the strides attribute of a numpy array numpy/numpy#28925 was merged in the last day or so.We shouldn't really have to backport this, since it is slated for NumPy
2.4.x
series, but if it becomes annoying on the maintenance branch we could backport it since it is a test-only shim (though not running dev version tests on maintenance branches is also something we discussed in the past).