Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
9b7d707a
提交
9b7d707a
authored
3月 20, 2024
作者:
Ricardo Vieira
提交者:
Ricardo Vieira
3月 20, 2024
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Suppress caching warning when compiling Numba functions
上级
475fe3a0
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
20 行增加
和
1 行删除
+20
-1
basic.py
pytensor/link/numba/dispatch/basic.py
+8
-1
test_basic.py
tests/link/numba/test_basic.py
+12
-0
没有找到文件。
pytensor/link/numba/dispatch/basic.py
浏览文件 @
9b7d707a
...
@@ -14,7 +14,7 @@ import scipy
...
@@ -14,7 +14,7 @@ import scipy
import
scipy.special
import
scipy.special
from
llvmlite
import
ir
from
llvmlite
import
ir
from
numba
import
types
from
numba
import
types
from
numba.core.errors
import
TypingError
from
numba.core.errors
import
NumbaWarning
,
TypingError
from
numba.cpython.unsafe.tuple
import
tuple_setitem
# noqa: F401
from
numba.cpython.unsafe.tuple
import
tuple_setitem
# noqa: F401
from
numba.extending
import
box
,
overload
from
numba.extending
import
box
,
overload
...
@@ -61,6 +61,13 @@ def global_numba_func(func):
...
@@ -61,6 +61,13 @@ def global_numba_func(func):
def
numba_njit
(
*
args
,
**
kwargs
):
def
numba_njit
(
*
args
,
**
kwargs
):
kwargs
.
setdefault
(
"cache"
,
config
.
numba__cache
)
kwargs
.
setdefault
(
"cache"
,
config
.
numba__cache
)
# Supress caching warnings
warnings
.
filterwarnings
(
"ignore"
,
message
=
'Cannot cache compiled function "numba_funcified_fgraph" as it uses dynamic globals'
,
category
=
NumbaWarning
,
)
if
len
(
args
)
>
0
and
callable
(
args
[
0
]):
if
len
(
args
)
>
0
and
callable
(
args
[
0
]):
return
numba
.
njit
(
*
args
[
1
:],
**
kwargs
)(
args
[
0
])
return
numba
.
njit
(
*
args
[
1
:],
**
kwargs
)(
args
[
0
])
...
...
tests/link/numba/test_basic.py
浏览文件 @
9b7d707a
...
@@ -7,6 +7,8 @@ from unittest import mock
...
@@ -7,6 +7,8 @@ from unittest import mock
import
numpy
as
np
import
numpy
as
np
import
pytest
import
pytest
from
tests.tensor.test_math_scipy
import
scipy
numba
=
pytest
.
importorskip
(
"numba"
)
numba
=
pytest
.
importorskip
(
"numba"
)
...
@@ -1064,3 +1066,13 @@ def test_OpFromGraph():
...
@@ -1064,3 +1066,13 @@ def test_OpFromGraph():
zv
=
np
.
ones
((
2
,
2
),
dtype
=
config
.
floatX
)
*
5
zv
=
np
.
ones
((
2
,
2
),
dtype
=
config
.
floatX
)
*
5
compare_numba_and_py
(((
x
,
y
,
z
),
(
out
,)),
[
xv
,
yv
,
zv
])
compare_numba_and_py
(((
x
,
y
,
z
),
(
out
,)),
[
xv
,
yv
,
zv
])
@pytest.mark.filterwarnings
(
"error"
)
def
test_cache_warning_suppressed
():
x
=
pt
.
vector
(
"x"
,
shape
=
(
5
,),
dtype
=
"float64"
)
out
=
pt
.
psi
(
x
)
*
2
fn
=
function
([
x
],
out
,
mode
=
"NUMBA"
)
x_test
=
np
.
random
.
uniform
(
size
=
5
)
np
.
testing
.
assert_allclose
(
fn
(
x_test
),
scipy
.
special
.
psi
(
x_test
)
*
2
)
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论