[英]Numba failing to compile with very strange message - seems like this should work?
我有一个简单的 function 无法使用 Numba 的 @njit 装饰器进行编译:
@njit(fastmath=True, nogil=True)
def insert_into_array(array, pos, array_to_insert):
start = array[0:pos]
end = array[pos:len(array)]
inserted = np.concatenate((start, array_to_insert))
return np.concatenate(inserted, end)
此消息失败:
Failed in nopython mode pipeline (step: nopython frontend)
Invalid use of Function(<function concatenate at 0x000001E88B04E8B0>) with argument(s) of type(s): (array(uint8, 1d, C), array(uint8, 1d, C))
* parameterized
In definition 0:
All templates rejected with literals.
In definition 1:
All templates rejected without literals.
This error is usually caused by passing an argument of a type that is unsupported by the named function.
[1] During: resolving callee type: Function(<function concatenate at 0x000001E88B04E8B0>)
请注意,失败的类型是(array(uint8, 1d, C), array(uint8, 1d, C))
- 基本上试图连接两个简单的 1d arrays。
由于 NumPy 的concatenate
function 被 Numba 列为受支持的 function,因此我很难理解我应该如何解决这个问题。
我在 Python 3.7 和 Numba 0.50
关于我做错了什么的任何想法?
谢谢!
这看起来像一个 function,它根本不会从一开始就麻木了。 无论如何, np.concatenate
的第一个参数应该是一个元组,你不能传递 var args。 您的最后一个电话正在尝试。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.