python - numba.core.errors.TypingError:使用 np.random.randint() 时
问题描述
如何np.random.randint
与 numba 一起使用,因为这会引发非常大的错误,https://hastebin.com/kodixazewo.sql
from numba import jit
import numpy as np
@jit(nopython=True)
def foo():
a = np.random.randint(16, size=(3,3))
return a
foo()
解决方案
有关var的更多详细信息,请参见此处。nopython
from numba import jit
import numpy as np
import warnings
warnings.filterwarnings("ignore") # suppress NumbaWarning - remove and read for more info
@jit(nopython=False) # I guess we need the Python interpreter to randomize with more than 2 parameters in np.random.randint()
def foo():
a = np.random.randint(16, size=(3,3))
return a
foo()
推荐阅读
- r - 使用 ggplot stat_summary 绘制 p 值
- r - 修复 read.csv 的建议
- javascript - 用户缺少 Adonis JS 主键值
- python - 在 Python 中合并两个数据框后,如何找到未成功合并的数据框行?
- javascript - 无法在类星体框架中加载我自己的字体
- java - 从标准结果java 8中获取第一个值(我猜的数组列表)
- webrtc - WebRTC 和 NAT 遍历
- java - 为什么在组合键值对(组合图表记录)的问题中应该是int[i]=int[i]+d?
- asp.net - 在 IE11 上发布后,Angular 应用程序不会加载
- html - 如何水平显示图像