【发布时间】:2021-07-31 04:21:27
【问题描述】:
您好,我有一个关于使用 jit 编译器制作零填充数组的问题。主要是想做这样的数组:
new_state_matrix = np.zeros([state_matrix.shape[0], state_matrix.shape[1]], dtype=np.uint8)
我有这个错误:
numba.core.errors.TypingError: Failed in nopython mode pipeline (step: nopython frontend)
No implementation of function Function(<built-in function zeros>) found for signature:
>>> zeros(list(int64)<iv=None>, dtype=class(uint8))
There are 2 candidate implementations:
- Of which 2 did not match due to:
Overload of function 'zeros': File: numba\core\typing\npydecl.py: Line 511.
With argument(s): '(list(int64)<iv=None>, dtype=class(uint8))':
No match.
During: resolving callee type: Function(<built-in function zeros>)
During: typing of call at C:\Users\d4wt0\Desktop\koderka\MW\proj1\venv\methods.py (850)
File "methods.py", line 850:
def nbh_check(state_matrix, img_matrix, nbh):
new_state_matrix = np.zeros([state_matrix.shape[0], state_matrix.shape[1]], dtype=np.uint8)
^
任何想法如何使它工作?任何 numba 类型的函数之类的?
【问题讨论】: