考虑以下脚本:
from numba import guvectorize, u1, i8
import numpy as np
@guvectorize([(u1[:],i8)], '(n)->()')
def f(x, res):
res = x.argmax()
x = np.array([1,2,3],dtype=np.uint8)
print(f(x))
print(x.argmax())
print(f(x))
运行它时,我得到以下信息:
4382569440205035030
2
2
为什么会这样?有没有办法让它正确?