Numba documentation suggests the following code should compile
@njit()
def accuracy(x,y,z):
x.argsort(axis=1)
# compare accuracy, this code works without the above line
accuracy_y = int(((np.equal(y, x).mean())*100)%100)
accuracy_z = int(((np.equal(z, x).mean())*100)%100)
return accuracy_y,accuracy_z
It fails on x.argsort(), I have also tried the following with and without axis arguments
np.argsort(x)
np.sort(x)
x.sort()
However I get the following failed to compile error (or similar):
numba.core.errors.TypingError: Failed in nopython mode pipeline (step: nopython frontend)
No implementation of function Function(<function sort at 0x000001B3B2CD2EE0>) found for signature:
>>> sort(array(int64, 2d, C))
There are 2 candidate implementations:
- Of which 2 did not match due to:
Overload of function 'sort': File: numba\core\typing\npydecl.py: Line 665.
With argument(s): '(array(int64, 2d, C))':
No match.
During: resolving callee type: Function(<function sort at 0x000001B3B2CD2EE0>)
File "accuracy.py", line 148:
def accuracy(x,lm,sfn):
<source elided>
# accuracy
np.sort(x)
^
What am I missing here?
np.sort(x)line being passed into numba.