簡體   English   中英

使用 numba 重載時 Python 內核死掉

[英]Python kernel dies when using numba overload

我試圖通過使用 numba 的重載(此處的文檔)在 numba jitted 函數中使用外部定義的函數,但是當我運行它時 Python 內核死了。 這是我重現的最小示例:

from numpy.polynomial.legendre import leggauss as lg  # My externally defined function
import numba as nb
from numba.extending import overload

@overload(lg)
def implimentlg(n):
   if not isinstance(n, (int, nb.types.Integer, nb.int32)):
      raise nb.errors.TypingError("must be int")

   def impli(n):
      return lg(n)
   return impli

@nb.jit(nopython=True)
def tmp():
   return lg(15)

tmp()

我猜我的問題與我的implimentlg函數中的輸入有關,但是沒有堆棧跟蹤我就不知所措了。

問題是我使用neovim包“nvim-ipy”在iPython終端中運行我的python代碼。 直接使用python3 myFile.py運行我的代碼給出了堆棧跟蹤。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM