Cannot determine Numba type of <class ‘numba.core.dispatcher.LiftedLoop‘

x33g5p2x  于2021-12-02 转载在 其他  
字(0.5k)|赞(0)|评价(0)|浏览(335)

Cannot determine Numba type of <class 'numba.core.dispatcher.LiftedLoop'

解决ok。

代码:

@jit()
def initial_background(I_gray, N):
    # symmetric:对称填充
    I_pad = np.pad(I_gray, 1, 'symmetric')
    height = I_pad.shape[0]
    width = I_pad.shape[1]
    samples = np.zeros((height, width, N))
    for i in range(1, height - 1):
        for j in range(1, width - 1):
            for n in range(N):
                x, y = 0, 0
                while (x == 0 and y == 0):
                    x = np.random.randint(-1, 1)
                    y = np.random.randint(-1, 1)
                ri = i + x
                rj = j + y
                samples[i, j, n] = I_pad[ri, rj]
    samples = samples[1:height - 1, 1:width - 1]
    return samples

报错:

Compilation is falling back to object mode WITH looplifting

相关文章

微信公众号

最新文章

更多