guvectorize function that returns a scalar

0 views
Skip to first unread message

Feng Shi

unread,
Mar 10, 2018, 12:24:10 PM3/10/18
to Numba Public Discussion - Public
Hi all, I am wondering if it is possible to return a scalar from guvectorize.

I was able to do it in python2.7. Here is the dummy code

@guvectorize([(int64,float64[:],float64[:])], '(),(N)->()', target='cuda')
def f(i,theta,res):
    res[0] = -1.0

Now I switched to python3.6 and it does not work anymore. It gives error: signature=(int64, array(float64, 1d, A), array(float64, 1d, A)) -> none>) with parameters (int64, array(float64, 1d, A), float64)

The error is self-explanatory and I guess I just got lucky with python2. I cannot use @vectorize because the parameter theta is a vector. Any ideas? Thank you!

Bill

Reply all
Reply to author
Forward
0 new messages