小编Geo*_*ohn的帖子

numba nopython模式"Undefined variable'$ 313.3'"

这是我从图像构造最小树的代码(f是由scipy提供的图像)

这是我写的缝纫雕刻计划的基础.

此代码段在普通python中按预期工作.当我@numba.jit没有使用时nopython=True,它也可以工作(性能提高约200%!),但这是在对象模式下.

当我尝试使用nopython=True模式时,它不会编译,我收到错误:

Failed at nopython (nopython frontend)
Undefined variable '$313.3'
Run Code Online (Sandbox Code Playgroud)

我不明白为什么这不会编译,因为我没有看到任何可能未定义的东西.

from numba import jit
from scipy import misc
import numba

f = misc.face()
@jit(nopython=True)
def explorethisx(inar, x):
    places = []
    places.append((x,0))
    x1,y1 = x,0
    s = numba.int64(0)
    co = 0
    #for _ in range( 799):

    while co != numba.int16(799):
        co += 1
        a1,a2,a3 = 999,999,999
        a1 = inar[y1 + 1][x1-1][1]
        a2 = inar[y1 + 1][x1][1]
        a3 = inar[y1 + …
Run Code Online (Sandbox Code Playgroud)

python numpy numba

4
推荐指数
1
解决办法
663
查看次数

标签 统计

numba ×1

numpy ×1

python ×1