擅长:python、mysql、java
<p>当你遇到错误时,礼貌的做法是表现出错误。有时回溯的完全错误是合适的。对于<code>numba</code>来说,这可能太多了,但是您应该尝试发布一个摘要。它使我们更容易,特别是当我们无法运行您的代码并亲自看到错误时。你甚至可以学到一些东西。你知道吗</p>
<p>我运行了你的例子,得到(部分):</p>
<pre><code>In [428]: numbadiff(np.ones((2,2))[:,0])
-
TypingError
...
TypeError: reshape() supports contiguous array only
...
def diff_impl(a, n=1):
<source elided>
# To make things easier, normalize input and output into 2d arrays
a2 = a.reshape((-1, size))
...
TypeError: reshape() supports contiguous array only
....
This is not usually a problem with Numba itself but instead often caused by
the use of unsupported features or an issue in resolving types.
</code></pre>
<p>这支持@jdehesa提供的诊断和修复。这不是<code>numba</code>中的bug,而是您的输入有问题。你知道吗</p>
<p>使用<code>numba</code>的一个缺点是错误更难理解。另一个明显的问题是,它对于诸如这个数组视图之类的输入没有那么灵活。如果你真的想要速度上的优势,你需要愿意自己去挖掘错误信息。你知道吗</p>