实际上,这是在PR #776main
中修复的 Awkward Array 中的一个错误,当您阅读本文时,它可能会合并到分支中。
我认识到很难将用户错误与内部错误与错误消息区分开来 - Awkward Array 中的一般规则RuntimeError
是内部错误,ValueError
是用户错误 - 但是当 Numba 尝试确定类型时出现任何错误as TypeError
,不管它是什么。(在这种情况下,它是一个AttributeError
! 它试图numba.bool
在正确的拼写是 时访问numba.boolean
。)
但是,如果您认为某事可能是错误,则将其报告为GitHub 问题会更容易。打印出整个错误消息也很有帮助,如下所示:
E numba.core.errors.TypingError: Failed in nopython mode pipeline (step: nopython frontend)
E No implementation of function Function(<built-in function getitem>) found for signature:
E
E >>> getitem(ak.ArrayView(ak.VirtualArrayType({"class":"ListOffsetArray64","offsets":"i64","content":{"class":"RecordArray","contents":{"x":{"class":"NumpyArray","inner_shape":[],"itemsize":1,"format":"?","primitive":"bool","has_identities":false,"parameters":{},"form_key":null}},"has_identities":false,"parameters":{},"form_key":null},"has_identities":false,"parameters":{},"form_key":null}, none, {}), None, ()), Literal[int](2))
E
E There are 28 candidate implementations:
E - Of which 26 did not match due to:
E Overload of function 'getitem': File: <numerous>: Line N/A.
E With argument(s): '(ak.ArrayView(ak.VirtualArrayType({"class":"ListOffsetArray64","offsets":"i64","content":{"class":"RecordArray","contents":{"x":{"class":"NumpyArray","inner_shape":[],"itemsize":1,"format":"?","primitive":"bool","has_identities":false,"parameters":{},"form_key":null}},"has_identities":false,"parameters":{},"form_key":null},"has_identities":false,"parameters":{},"form_key":null}, none, {}), None, ()), int64)':
E No match.
E - Of which 2 did not match due to:
E Overload in function 'type_getitem.generic': File: ../../../../irishep/awkward-1.0/awkward/_connect/_numba/arrayview.py: Line 575.
E With argument(s): '(ak.ArrayView(ak.VirtualArrayType({"class":"ListOffsetArray64","offsets":"i64","content":{"class":"RecordArray","contents":{"x":{"class":"NumpyArray","inner_shape":[],"itemsize":1,"format":"?","primitive":"bool","has_identities":false,"parameters":{},"form_key":null}},"has_identities":false,"parameters":{},"form_key":null},"has_identities":false,"parameters":{},"form_key":null}, none, {}), None, ()), int64)':
E Rejected as the implementation raised a specific error:
E AttributeError: module 'numba' has no attribute 'bool'
E raised from /home/jpivarski/irishep/awkward-1.0/awkward/_connect/_numba/layout.py:565
E
E During: typing of intrinsic-call at /home/jpivarski/irishep/awkward-1.0/tests/test_0776-numba-booleans-in-array.py (16)
E During: typing of static-get-item at /home/jpivarski/irishep/awkward-1.0/tests/test_0776-numba-booleans-in-array.py (16)
E
E File "tests/test_0776-numba-booleans-in-array.py", line 16:
E def f1(array):
E return array[2][0].x
E ^
../../miniconda3/lib/python3.8/site-packages/numba/core/dispatcher.py:357: TypingError
幸运的是,您引用的错误消息部分包括“ module 'numba' has no attribute 'bool'
”部分,这给了我一个开始的地方。但是理解这个Photon
虚拟数组的错误至关重要——错误numba.bool
发生在虚拟数组处理中。(Coffea NanoEvents 是虚拟的——它们按需从 ROOT 文件中读取数据,甚至在 Numba JIT 编译的函数中。)完整的错误消息包括这个数组具有VirtualArrayType
.
最好的错误报告包括一些重现问题的数据(例如,您是如何获得Photon
对象的?),但GitHub 问题模板会提示您这样做。
不过,感谢您报告这个!任何报告都有帮助!