-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Open
Labels
Description
dask+sparse works, but not sparse+dask.
I think dask should probably implement this case, via it's __array_ufunc__ method. Here's the traceback:
In [1]: import sparse
In [2]: import dask.array as da
In [3]: import numpy as np
In [4]: x = np.arange(3)
In [5]: y = sparse.COO(x)
In [6]: z = da.from_array(y, chunks=3)
In [7]: z + y
Out[7]: dask.array<add, shape=(3,), dtype=int64, chunksize=(3,)>
In [8]: y + z
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-8-ff96b8185f8d> in <module>
----> 1 y + z
~/miniconda3/envs/xarray-py37-dev/lib/python3.7/site-packages/numpy/lib/mixins.py in func(self, other)
23 if _disables_array_ufunc(other):
24 return NotImplemented
---> 25 return ufunc(self, other)
26 func.__name__ = '__{}__'.format(name)
27 return func
TypeError: operand type(s) all returned NotImplemented from __array_ufunc__(<ufunc 'add'>, '__call__', <COO: shape=(3,), dtype=int64, nnz=2, fill_value=0>, dask.array<array, shape=(3,), dtype=int64, chunksize=(3,)>): 'COO', 'Array'