python - Numba 嵌套函数不会执行(0.47 版)
问题描述
我很困惑为什么这不起作用,文档说:
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)
解决方案
Soln:不要使用类型声明并删除内部 jit 装饰器
推荐阅读
- list - 检查元组列表中的所有第一个元素是否满足条件
- python - 事务处理和构建事务处理有什么区别?
- tinymce - 如果包含 JavaScript 代码,如何防止 TinyMCE 从“a”标签中删除 href 属性?
- c - 在预处理器指令中使用除 # 之外的另一个字符
- python - 提高视频流畅度
- javascript - 将谷歌图表中特定饼图(最后一个索引)的颜色定义为红色
- html - 如何在 col-lg-8 中固定元素按钮?
- git - NPM 编译因不存在的错误而失败
- gnuplot - gnuplot中符号和文本之间的图例中的空格
- c# - 可以在运行时更新带有 XML 源的 DisplayNameAttribute 扩展吗?