Ignore CuPy NumPy shape deprecation warning#1105
Conversation
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
gforsyth
left a comment
There was a problem hiding this comment.
![]()
This will be fixed upstream in cupy
|
Hmmmm, seems there is a copy inside cucim, which needs fixing. Maybe one could even avoid diff --git a/python/cucim/src/cucim/skimage/_vendored/pad.py b/python/cucim/src/cucim/skimage/_vendored/pad.py
index 28bf916..dfd3be4 100644
--- a/python/cucim/src/cucim/skimage/_vendored/pad.py
+++ b/python/cucim/src/cucim/skimage/_vendored/pad.py
@@ -408,8 +408,7 @@ def _as_pairs(x, ndim, as_index=False):
# Converting the array with `tolist` seems to improve performance
# when iterating and indexing the result (see usage in `pad`)
- x_view = x.view()
- x_view.shape = (ndim, 2)
+ x_view = x.reshape(ndim, 2)
return x_view.tolist() |
|
Thanks Bradley! 🙏 @grlee77 could you please take a look? |
|
@seberg, I need to check if we still need this vendored |
|
Thanks @bdice, please also make the fix suggested by @seberg for the vendored copy of The vendored version was based on the CuPy one, but has a specialized element-wise kernel path for a subset of the boundary modes that is automatically selected for performance depending on the internal |
|
Thanks Greg! 🙏
Independent of this PR, but do we see a path to upstreaming some (or all) of this logic to CuPy? Admittedly this may be complicated if logic higher up in an particular image operation is influencing how the padding is done |
|
Looked through the cases where we are doing Have done this in PR: #1106 Would appreciate if all of you took a look 🙂 |
grlee77
left a comment
There was a problem hiding this comment.
Thanks, this warning ignore looks good to me
It looks like @jakirkham is addressing other shape assignment issues in #1106
f9ddcec to
8cb4254
Compare
|
Think we need both fixes in the same PR. Have seen some issues with CI if both are not present Went ahead and merged this PR into PR: #1106 Hope that is ok |
|
Thanks @jakirkham! Closing this in favor of #1106. |
Summary
Fixes NumPy 2.5
DeprecationWarningfailures triggered when pytest promotes deprecations to errors.This PR:
reshapeinstead of assigning tondarray.shapeRoot Cause
The failing CI job used Python 3.12, NumPy 2.5.0, and CuPy 14.1.1. NumPy 2.5 warns when code assigns directly to
ndarray.shape; cucim's pytest config treatsDeprecationWarningas an error.The extracted failures came from three locations:
cucim/skimage/_vendored/pad.py::_as_pairscupy/_padding/pad.py::_as_pairsskimage/measure/_marching_cubes_lewiner.pyThe cucim-owned vendored helper is fixed directly. The CuPy and scikit-image occurrences are upstream dependency warnings, so they are filtered narrowly by module.
Validation
Created an isolated conda environment at
.conda-cucim-cupy-np25with Python 3.12.13, NumPy 2.5.0, CuPy 14.1.1, and the cucim test dependencies.Extracted the failing node IDs from the CI log for
actions/runs/28078321887/job/83129420085:Ran the exact extracted subset locally with GPU access outside the sandbox:
Result:
Also ran: