-
-
Notifications
You must be signed in to change notification settings - Fork 786
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
cupyx.ndimage.measurements: add center_of_mass, histogram, labeled_comprehension #4311
cupyx.ndimage.measurements: add center_of_mass, histogram, labeled_comprehension #4311
Conversation
sorry to ask this, but could you please align the tests to those of #4307? Thanks! |
Sure. I will do it for the recent |
55be4ca
to
50debde
Compare
remove unused code path use single quotes remove misplaced quote TST: make style of new tests consistent with changes in cupygh-4307
50debde
to
5b11e68
Compare
rebased to fix merge conflict. should be ready for testing |
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.
LGTM
TODO: Add docs |
Jenkins, test this please |
I have already added this one to the API docs. |
Jenkins CI test (for commit 5b11e68, target branch master) succeeded! |
This PR adds three functions to
cupyx.scipy.ndimage.measurements
center_of_mass
labeled_comprehension
(applies an arbitrary function over each labeled region)histogram
(implemented vialabeled_comprehension
)One difference in behavior was made to avoid the need for object arrays (in this case, an arrays where each element is an array). This is used for histogram which calls
labeled_comprehension
usingdtype=object
so that each element of the object array is the histogram over a particular label. For the CuPy implementation, a list of arrays is returned instead of an object array.If the return value is a scalar in the scipy implementation, a 0-dimensional device array is returned instead here to avoid device->host transfers as much as possible.
I also suppressed all instances of
cupy._util.PerformanceWarning
occuring in the tests of this module that existed prior to this PR.