这是 numba 的基本示例
import numpy as np
from numba import double
from numba.decorators import jit, autojit
X = np.random.random((1000, 3))
def pairwise_python(X):
M = X.shape[0]
N = X.shape[1]
D = np.empty((M, M), dtype=np.float)
for i in range(M):
for j in range(M):
d = 0.0
for k in range(N):
tmp = X[i, k] - X[j, k]
d += tmp*tmp
D[i, j] = np.sqrt(d)
return D
pairwise_numba = autojit(pairwise_python)
pairwise_numba(X)
但它会生成错误消息
AttributeError: Failed at object (object mode frontend)
Failed at object (object mode backend)
'Module' object has no attribute 'global_variables'
我的康达版本是
numba 0.18.2 np19py27_1
numbapro 0.18.0 np19py27_p2
llvmlite 0.4.0 py27_0
你有同样的问题吗?帮我..