Hello!
Amazing job with the numba version 0.52.0, I would like to report what seems to be an unexpected behaviour (in my limited experience)
a = np.asarray([[1,2,-3,-3,4],[0,0,0,0,0]])
#This works without njiting
@njit
def fii(arr, val):
return np.delete(arr, np.where(arr==val))
fii(a, -3)
The point is that with arr (input arr) is a 1D array; njited fii() only works if np.where does not return the tuple ([whatever indexes],)
'''this works:'''
a = np.asarray([1,2,-3,-3,4])
#Does not work if you don't delete the tuple returned by np.where
@njit
def fii(arr, val):
return np.delete(arr, np.where(arr==val)[0])
fii(a, -3)
If using numpy, it works correctly in all the cases, is this something expected?
Hi and thank you for your kind words. We do appreciate your feedback! Could you perhaps elaborate on the results you expect and what you see instead. I.e. what does “does not work” mean?
and in the case presented np.where is returning a tuple or np.ndarray. I think NumPy is dealing with this by doing asarray followed by ravel:
I suggest opening a feature request on Numba’s issue tracker if this is important to you. It could well require clarification from NumPy before a fix is made. As a work around, can you just do the indexing for now?
Hi Stuart,
Thanks a lot for the replay, somehow I figure it out like raveling the array and reshaping. Please let me know if it worth for Numba to have an open issue on that topic and I will do so.