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
Allow dtype input argument in np.sum #4472
Conversation
@luk-f-a thanks for getting this going! I'll mark it as |
I have implemented the case |
@luk-f-a thanks, I have scheduled it for a preliminary review. |
@luk-f-a thanks for the patch. I think this approach is likely to work, but as noted on gitter, have to wonder about the longevity of such an addition. That said, it seems to be less involved than anticipated, so perhaps complete this and ensure there's an exceptionally good set of tests for it and this can then really help guide refactoring these implementations to use the newer APIs at some point in the future. What do you think? |
@stuartarchibald, sounds good, I'll add more tests. Do you think this will be replaced in the short term? I ask because I have an ugly solution that works for |
@stuartarchibald, I have added more tests. Maybe too many 😄 . I test over a full range of dtypes, for all 4 implentations: The error with timedelta comes from Please have a look and let me know if these tests cover what you had in mind. |
@luk-f-a, thanks for this, I've taken a look at the tests, this level of detail seems appropriate given the changes proposed. I think some more effort will be needed code generation wise as it seems that the compiler might be being hit too often, will take a closer look when this is nearer ready.
Suspect the timedelta types are lacking numba/numba/typing/builtins.py Lines 681 to 704 in 60d2bdd
|
@stuartarchibald , I've fixed the problem with |
@luk-f-a excellent, good job. Yes, if the |
Seems like there's some windows CI failures, suspect it's |
@stuartarchibald I created an issue for |
If they are entirely superfluous given the new tests then yes please, the build is starting to hit CI wall time limits! |
As title
Also, luk-f-a#2 word wraps the text. |
thanks.
sorry, I don't understand how that happened, locally the file was still there. maybe I should not push in the evening. |
numba/tests/test_array_methods.py
Outdated
@@ -170,6 +179,12 @@ def array_sum_const_axis_neg_one(a, axis): | |||
# "const_multi" variant would raise errors | |||
return a.sum(axis=-1) | |||
|
|||
def array_mean(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.
not sure these are supposed to be here either?
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.
you're too fast, I was just reverting those. I think I got on the wrong side of PyCharm smart checkout, and it brought those from my branch working on np.mean
. I think I cleaned it now.
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.
Done! Thanks very much for your patience and persistence in implementing this, much appreciated. I think a large number of users will be grateful for this patch/feature too!
🎉 |
@stuartarchibald , thanks for all your help and patience. I hope this will allow the improvement of other functions (like np.mean getting an |
@esc, thanks for your review and comments. |
@luk-f-a no problem, now we just need to massage it through CI.. |
@esc @stuartarchibald I don't think |
@luk-f-a I don't think the cov timeout is caused by this PR.. Think it is pretty safe to assume this PR will be O.K. |
For azure only the coverage run timed out. Probably safe to merge. |
closes #4220