Unexpected warning when adding arrays with non-matching coordinates
dekuenstle opened this issue · comments
Describe the bug
Unexpected and wrong warning when creating an "empty" sparse array.
It happens, for example, internally, when adding two arrays without matching coordinates.
To Reproduce
import warnings
import sparse
import numpy as np
with warnings.catch_warnings():
warnings.simplefilter("always")
a = sparse.COO(np.array([[1], [1]]), np.array([1]), shape=(5, 5))
b = sparse.COO(np.array([[2], [2]]), np.array([1]), shape=(5, 5))
a + b # triggers a warning
# ... internally caused by ...
sparse.COO(np.empty((4, 0)), np.array([]), shape=(5, 5))
# see _umath.py: matched_arrays = [ ...
Output
DeprecationWarning: coords should be an ndarray. This will raise a ValueError in the future.
Expected behavior
No warning.
System
- OS and version: Ubuntu
sparse
version: 0.14.0- NumPy version (
np.__version__
): 1.23.5 - Numba version (
numba.__version__
): 0.56.4
Thanks for the report! Could you reproduce on the development version by any chance?
This should already have been fixed by #581.
Thanks! Yes, #581 did the job.