numpy.hstack()无法在固定功能中运行

时间:2019-01-16 12:22:33

标签: python python-3.x numpy jit numba

numba网站https://numba.pydata.org/numba-doc/dev/reference/numpysupported.html表示它支持numpy.hstack()。但实际上,事实并非如此。

from numba import njit
import numpy as np

@njit
def func(data):return np.hstack((np.nan, data))

myarray = np.arange(100)*0.1
X =func(myarray)

那么我在这里想念什么?该函数看起来微不足道,但无法正常工作。错误消息如下:

TypingError: Invalid use of Function(<function hstack at 0x0000022D26441BF8>) with argument(s) of type(s): ((float64, array(float64, 1d, C)))
 * parameterized
In definition 0:
    TypeError: np.hstack(): expecting a non-empty tuple of arrays, got (float64, array(float64, 1d, C))
    raised from C:\Users\User\Anaconda3\lib\site-packages\numba\typing\npydecl.py:806
In definition 1:
    TypeError: np.hstack(): expecting a non-empty tuple of arrays, got (float64, array(float64, 1d, C))
    raised from C:\Users\User\Anaconda3\lib\site-packages\numba\typing\npydecl.py:806
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 hstack at 0x0000022D26441BF8>)
[2] During: typing of call at C:/Users/User/Desktop/all python file/4.2.1/np_stack_test_njit.py (13)

谢谢大家

0 个答案:

没有答案