【发布时间】:2020-01-20 06:26:05
【问题描述】:
我很困惑为什么这不起作用,文档说:
2.6.1.2.3。内部函数和闭包: Numba 现在支持内部函数,只要它们是非递归的并且仅在本地调用,但不作为参数传递或作为结果返回。闭包变量(在外部范围中定义的变量)的使用 也支持内部函数。
import numba
@numba.jit(nopython=True, debug=False, parallel=False, cache=True)
def outer() -> int:
@numba.jit(nopython=True, debug=False, parallel=False, cache=True)
def inner() -> int:
return 1
return inner()
outer()
还有错误:
Failed in nopython mode pipeline (step: analyzing bytecode)
op_MAKE_FUNCTION with annotations is not implemented
我在这里做了什么傻事吗?
(操作系统:Ubuntu 19.10)
【问题讨论】:
-
您是否在刻意测试
numba是否支持类型提示?如果没有,删除-> int可能会解决您的问题。如果是这样,这可能是一个错误,除非真正了解 numba 的人说不是,否则我建议您 report it by filing an issue in the github repository 或采取类似行动。 -
我试过了(删除类型提示),它不起作用