guvectorize does not implement the numpy ufunc interface in versions 0.53+
See original GitHub issueHi, after upgrading numba from version 0.52.0 to either versions 0.53.0 or 0.54.0, I have found that the signature field of functions compiled using @guvectorize no longer is implemented.
Tested with: numpy version 1.20.0 numba version 0.52.0, 0.53.0, 0.54.0
Here is a minimal working example:
from numba import guvectorize
@guvectorize(["void(float64[:], float64[:], float64[:])"],
"(n),(n)->()", nopython=True, cache=True)
def test(a, b, c):
c[0]=0
for i in range(len(a)):
c[0] += a[i]*b[i]
When I try using this, here’s what happens with 0.52.0:
In [1]: import test_gufunc
In [2]: test_gufunc.test.signature
Out[2]: '(n),(n)->()'
And here’s what I get with the newer versions:
In [1]: import test_gufunc
In [2]: test_gufunc.test.signature
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-2-d4d284438f75> in <module>
----> 1 test_gufunc.test.signature
AttributeError: 'GUFunc' object has no attribute 'signature'
Reporting a bug
- I have tried using the latest released version of Numba (most recent is visible in the change log (https://github.com/numba/numba/blob/master/CHANGE_LOG).
- I have included a self contained code sample to reproduce the problem. i.e. it’s possible to run as ‘python bug.py’.
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Creating NumPy universal functions - Numba documentation
Numba's vectorize allows Python functions taking scalar input arguments to be used as NumPy ufuncs. Creating a traditional NumPy ufunc is not the...
Read more >Numba guvectorize exception due to Numpy ufunc signature
I understand the purpose of the algorithm is to obtain the average of a vector's slice. For example, having vector [1,2,3,4,5] and slice...
Read more >guvectorize returns different output after upgrading to Numpy ...
When using the new dynamic typing in Numba 0.53 it always works correctly, regardless whether the output array is np.uint8 or np.int8 ....
Read more >Enhancements to Numba's guvectorize decorator
In NumPy, it is fine to omit the output argument when calling a generalized ufunc. ... The same is not possible in a...
Read more >numpy.ufunc.reduce — NumPy v1.23 Manual
New in version 1.7.0. initialscalar, optional. The value with which to start the reduction. If the ufunc has no identity or the dtype...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Thanks for fixing this! I’ll be looking forward to the next release.
Hi @gmarkall, yes, that’s possible. I’ll send a PR shortly. @iguinn, thanks for reporting this bug!