Add shape=None to *_like() array creation functions#6064
Add shape=None to *_like() array creation functions#6064martindurant merged 19 commits intodask:masterfrom
shape=None to *_like() array creation functions#6064Conversation
|
Cc @mrocklin, @pentschev |
mrocklin
left a comment
There was a problem hiding this comment.
Thanks for doing this @andersy005 . I left some minor comments, mostly stylistic.
|
It looks like the test failures here are unrelated to the changes I made. |
jrbourbeau
left a comment
There was a problem hiding this comment.
Thanks @andersy005! I've restarted the failed CI builds here to see if any test failures persist
|
Merged master to hopefully fix the CI stuff. |
jsignell
left a comment
There was a problem hiding this comment.
Can you reproduce the failures locally?
Yes. All tests in |
|
I just ran the tests locally and there are genuine failures coming from the dask.dataframe tests. In particular, this test is faililng on most parameter values: dask/dask/dataframe/tests/test_ufunc.py Line 444 in ac38635 I can't quite figure out why yet... |
Me either. I spent some time this morning looking into it, but I still don't know yet the connection between the changes I made and the dask.dataframe. I could use some help in figuring it out :) |
|
Oh! I think I have something. I don't think the logic in the helper function is quite right. If shape is None it gets overridden and then chunks ends up being auto. I'll add a suggestion in a sec. |
|
Ok. So I think what is happening is in ufunc we end up trying to generate a meta and when we do that we call Lines 4756 to 4763 in dd682cc which in turn goes and calls So I think this is the only change that is needed: diff --git a/dask/dataframe/core.py b/dask/dataframe/core.py
index 72851b66..f059bb6c 100644
--- a/dask/dataframe/core.py
+++ b/dask/dataframe/core.py
@@ -4756,7 +4756,7 @@ def elemwise(op, *args, **kwargs):
parts = [
d._meta
if _is_broadcastable(d)
- else empty_like_safe(d, (), dtype=d.dtype)
+ else np.empty((), dtype=d.dtype)
if isinstance(d, Array)
else d._meta_nonempty
for d in dasks
|
|
With that diff the tests pass for me locally :) |
Many thanks for hunting this down! |
|
Hooray!! @dask/maintenance I think this one is ready! |
|
Thanks @andersy005 for the PR and everyone for the reviews! 😄 |
black dask/flake8 daskTowards fixing #4875