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

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

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

解决ok。

代码:

  1. @jit()
  2. def initial_background(I_gray, N):
  3. # symmetric:对称填充
  4. I_pad = np.pad(I_gray, 1, 'symmetric')
  5. height = I_pad.shape[0]
  6. width = I_pad.shape[1]
  7. samples = np.zeros((height, width, N))
  8. for i in range(1, height - 1):
  9. for j in range(1, width - 1):
  10. for n in range(N):
  11. x, y = 0, 0
  12. while (x == 0 and y == 0):
  13. x = np.random.randint(-1, 1)
  14. y = np.random.randint(-1, 1)
  15. ri = i + x
  16. rj = j + y
  17. samples[i, j, n] = I_pad[ri, rj]
  18. samples = samples[1:height - 1, 1:width - 1]
  19. return samples

报错:

Compilation is falling back to object mode WITH looplifting

相关文章