-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
ENH: ndimage: add axes support to most morphology functions #21549
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
c87e27c
to
6801608
Compare
@lucascolley : The Array API case is happy now. There was one seemingly unrelated failure in the "Oldest GCC" case, but I am rerunning that one now to see if it is reproducible |
|
Where does this PR stand @grlee77? |
@skip_xp_backends("cupy", | ||
reasons=["these filters do not yet have axes support"], | ||
cpu_only=True, | ||
exceptions=['cupy', 'jax.numpy']) |
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.
Please, not this pattern again :-).
Now that skip_xp_backends
decorators can be stacked, we can express things is a less confusing way. So these tests need to skip all non-cpu backends, and additionally you skip cupy and jax.numpy on CPU, is this correct?
Then,
@skip_xp_backends(cpu_only)
@skip_xp_backends("cupy", reason="these filters do not yet have axes support in CuPy")
@skip_xp_backends("jax.numpy", reason="these filters do not yet have axes support in JAX.numpy")
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, I will update it
CI is green modulo an unrelated failure in lapack wrappers on MacOS / OpenBLAS, let's land this. Thank you @grlee77 , all. |
@grlee77 mind adding a release note snippet for the upcoming 1.15 release please? |
Done. Thanks @ev-br, @lucascolley and @tylerjereddy for reviewing |
Reference issue
A series of previous MRs (#18016, #18261, #18305, #20809, #20811) addes axes support to ndimage functions in
_filters.py
.This MR extends the same
axes
support to most functions in_morphology.py
. All grayscale and binary morphology functions are covered, only the threedistance_transform_*
functions are not updated here.The changes needed to support axes were relatively small as all of these functions are based on either (
_filters._min_or_max_filter
or_binary_erosion
). Given that_min_or_max_filter
was already updated to support axes previously,_binary_erosion
is the main function updated here.cc: @ev-br, @lucascolley, @mdhaber and @dschmitz89 who had helped review some of the prior MRs.
What does this implement/fix?
The functions updated in this MR fall into two groups:
The grayscale morphology functions are based on calling
_filters._min_or_max_filter
which already hasaxes
support, so those were trivial to update here. These includegrey_dilation
,grey_erosion
,grey_opening
,grey_closing
,morphological_laplace
,morphological_gradient
,white_tophat
andblack_tophat
.The binary morphology functions are all based on
_binary_erosion
, which hasaxes
support added to it in this MR. These includebinary_erosion
,binary_dilation
,binary_opening
,binary_closing
,binary_hit_or_miss
,binary_propagation
andbinary_fill_holes
.Additional information
The testing approach follows that taken in the other recent MRs adding
axes
support to the filtering functions.