【发布时间】:2019-06-22 14:00:04
【问题描述】:
我目前正在使用一个函数来使用numpy.histogram() 和numpy.histogram2d() 创建直方图。为了加快使用numba 的过程,我尝试使用@jit 装饰器在nonpython 模式下进行解释,但是numba 报告了一个错误,说numpy.histogram() 是一个不受支持的功能。我的函数看起来像,
def make_histograms(X, neurons, bins = 5):
xy = np.histogram2d(X, neurons, bins)[0]
x = np.histogram(X, bins)[0]
y = np.histogram(neurons, bins)[0]
在我的情况下,还有其他解决方法可以使用 numba 吗?任何帮助将非常感激。在此先感谢:)
【问题讨论】:
-
如果你真的想这样做,看看source到
histogram。您几乎可以肯定地使用它使其与numba兼容,尽管它比您现在尝试的要冗长得多
标签: python performance numpy numba