Support `.squeeze()` for compatibility with `dask.array.matmul`
Sola85 opened this issue · comments
Currently matrix-multiplication with dask arrays based on sparse arrays does not work because the .squeeze() function is not implemented:
import dask.array as da
import scipy.sparse as sp
import sparse
x_da= da.from_array(sparse.COO.from_scipy_sparse(sp.rand(2**10, 2**10)), chunks=(256, 256))
res_da = (x_da@x_da).compute()
results in
AttributeError: 'COO' object has no attribute 'squeeze'
Since reshaping is supported, I am guessing that implementing squeeze() should be fairly easy?
Versions:
sparse: 0.13.0
dask: 2022.11.1
Python 3.8.10 (default, Jun 22 2022, 20:18:18)
[GCC 9.4.0] on linux
Yes, this is a fairly easy task to do.
Can someone guide me on how to contribute on this issue
@mtsokol Again, something in your wheelhouse.
@hameerabbasi Sure! We already got squeeze
in #613. Let me check it with Dask example.
I checked it and with the current main
branch of sparse:
x_da = da.from_array(sparse.COO.from_scipy_sparse(sp.rand(2**10, 2**10)), chunks=(256, 256))
res_da = (x_da @ x_da).compute()
correctly computes the result. So it was only COO.squeeze()
that was missing.
Completed in #613.