Repository navigation
Modify moment chunk functions to return dicts - #4519
Conversation
This is a follow-up on dask#4513.
|
Thanks @pentschev ! I'm curious, do cupy operations like std work after these changes? |
|
@pentschev you might also consider the following change to the diff --git a/dask/array/tests/test_sparse.py b/dask/array/tests/test_sparse.py
index 459609de..35b89f6d 100644
--- a/dask/array/tests/test_sparse.py
+++ b/dask/array/tests/test_sparse.py
@@ -33,6 +33,7 @@ functions = [
lambda x: x.T,
lambda x: da.transpose(x, (1, 2, 0)),
lambda x: x.sum(),
+ lambda x: x.std(),
lambda x: x.dot(np.arange(x.shape[-1])),
lambda x: x.dot(np.eye(x.shape[-1])),
lambda x: da.tensordot(x, np.ones(x.shape[:2]), axes=[(0, 1), (0, 1)]),When I do this I get the following traceback: dask/core.py:119: in _execute_task
return func(*args2)
dask/compatibility.py:93: in apply
return func(*args, **kwargs)
dask/array/reductions.py:385: in moment_chunk
n = numel(A, **kwargs).astype(np.int64)
dask/array/reductions.py:323: in numel
return chunk.sum(np.ones_like(x), **kwargs)
../../Software/anaconda/lib/python3.6/site-packages/numpy/core/numeric.py:263: in ones_like
res = empty_like(a, dtype=dtype, order=order, subok=subok)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <COO: shape=(1, 2, 2), dtype=float64, nnz=2, fill_value=0.0>, kwargs = {}, densify = False
def __array__(self, **kwargs):
from . import _AUTO_DENSIFICATION_ENABLED as densify
if not densify:
> raise RuntimeError('Cannot convert a sparse array to dense automatically. '
'To manually densify, use the todense method.')
E RuntimeError: Cannot convert a sparse array to dense automatically. To manually densify, use the todense method.
../sparse/sparse/sparse_array.py:213: RuntimeErrorI think that |
Well, AFAIK, there are no really "elaborate" tests for that, on my own simple tests it did. I will add that as well to #4486. |
|
I think that in general using the |
Right, we haven't supported these operations well before. I think that with this PR we're one step closer to supporting operations like |
|
My preference is generally to do things in smaller tasks rather than trying to fix all at once. I will then open an issue to tackle |
|
Sounds good. Thanks @pentschev |
|
Merging in 24 hours if there are no further comments. |
|
Opened new issue to tackle the sparse error in #4523. |
This is a follow-up on dask#4513.
This is a follow-up on #4513.
@mrocklin
flake8 dask