You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Dask Gufunc signatures should ignore whitespace #7972
What happened:
Today I was trying to write an da.as_gufunc wrapper for np.linalg.inv, since the dask version doesn't support having loop dimensions (e.g. 2D input works, 3D input, where the first dimension should be iterated over, doesn't work.)
The issue was the whitespace in my signature: "(n, n)->(n, n)" had to be "(n,n)->(n,n)". This is not mentioned in the [dask gufunc documentation](numba signature).
I would expect that the signature should work regardless of whitespace, since it is common to write, e.g. da.random.random((6, 5, 5)), and not be forced to random((6,5,5))`.
Anything else we need to know?:
I will point out that this was surprisingly difficult to figure out, since I wasn't thinking about whitespace - it would suddenly work (no whitespace) and then I would try a moment later (with whitespace) and it didn't work ("Am I going crazy?").
where we pass the signature to np.vectorize. This is probably a bug in NumPy (xref numpy/numpy#19597) though I think we could remove whitespace characters ourselves as a simple workaround. Is this something you're interested in contributing? (no obligation though)
Activity
[-]Dask Gufunc signatures should not ignore whitespace[/-][+]Dask Gufunc signatures should ignore whitespace[/+]jrbourbeau commentedon Aug 2, 2021
Thanks for raising an issue and providing a nice minimal reproducer @thomasaarholt!
It looks like the issue is arising here
dask/dask/array/gufunc.py
Lines 307 to 308 in 264c628
where we pass the signature to
np.vectorize. This is probably a bug in NumPy (xref numpy/numpy#19597) though I think we could remove whitespace characters ourselves as a simple workaround. Is this something you're interested in contributing? (no obligation though)jrbourbeau commentedon Aug 16, 2021
Just noting that the upstream issue in NumPy was resolved in numpy/numpy#19627
GenevieveBuckley commentedon Oct 14, 2021
I'm still observing this issue on Dask's main branch, fyi
GenevieveBuckley commentedon Oct 14, 2021
...ah, but my numpy version is 1.21.2
That's the latest version of numpy, but the fix numpy/numpy#19627 was introduced was merged the day after it was released.
So we can wait for the next numpy release to come out, at which point we should be able to close this issue.