Fix: dask.array.cumprod does not deal with dtype#12097
Fix: dask.array.cumprod does not deal with dtype#12097jacobtomlinson merged 4 commits intodask:mainfrom
dask.array.cumprod does not deal with dtype#12097Conversation
Unit Test ResultsSee test report for an extended history of previous test failures. This is useful for diagnosing flaky tests. 9 files ± 0 9 suites ±0 3h 10m 40s ⏱️ - 1m 40s Results for commit 09d4126. ± Comparison against base commit c60725b. ♻️ This comment has been updated with latest results. |
|
@mmccarty would you have some time to review this? |
The purpose of that |
|
It would also be a good to test that the result |
|
Thanks, @tonyyuyiding! |
|
@TomAugspurger I take your comment to be blocking on the implementation here, is that right? |
|
I hadn't looked at the diff yet, just the description :) So IIUC, the root cause here is a clash between a I'd be curious whether we could do |
Yes, that sounds right to me.
Thanks for the suggestion! I agree that using |
|
Great, thanks. My only remaining concern is whether we can assume that We can maybe treat "like" as meaning "has the same function signature and call this good enough, assuming the tests pass. |
I found that some |
Yep. That's a bit unfortunate, but I think that's our best option. I didn't mention it earlier, but I'd like to leave as much up to NumPy as possible. It's not 100% clear to me that |
TomAugspurger
left a comment
There was a problem hiding this comment.
If you're able to, it'd be nice to have a test that covers the case where func doesn't accept a dtype parameter.
I checked the places where |
jacobtomlinson
left a comment
There was a problem hiding this comment.
I see those tests already failed when I used partial without checking whether func accepts dtype.
Yep that seems to satisfy the request here.
Thanks for iterating on this!
dask.cumprodbrings different results withnumpy.cumprod#12054pre-commit run --all-filesThe problem is that
dask.array.cumproddoes not do type conversion usingdtype. It seems that numpy converts the data todtypefirst and then performs reduction.I chose a simple method to fix the issue, which is adding type conversion in
cumreduction. However, I noticed thatmap_blocksalso accepts adtypeparameter, but it does not actually convert data to that type, which is quite puzzling. Therefore, I wonder whether we should add type conversion inmap_blocksinstead. For example, the result ofis
[1.5 2.5], even thoughdtypehas been explicitly set tointThe current update has fixed the issue, but further suggestions are welcome :)