Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
a1a805c9
提交
a1a805c9
authored
2月 20, 2023
作者:
Ricardo Vieira
提交者:
Ricardo Vieira
2月 20, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix spurious warning from FusionOptimizer
上级
4730d0cb
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
23 行增加
和
0 行删除
+23
-0
elemwise.py
pytensor/tensor/rewriting/elemwise.py
+5
-0
test_elemwise.py
tests/tensor/rewriting/test_elemwise.py
+18
-0
没有找到文件。
pytensor/tensor/rewriting/elemwise.py
浏览文件 @
a1a805c9
...
@@ -692,6 +692,11 @@ class FusionOptimizer(GraphRewriter):
...
@@ -692,6 +692,11 @@ class FusionOptimizer(GraphRewriter):
fuseable_clients
:
FUSEABLE_MAPPING
=
defaultdict
(
list
)
fuseable_clients
:
FUSEABLE_MAPPING
=
defaultdict
(
list
)
unfuseable_clients
:
UNFUSEABLE_MAPPING
=
defaultdict
(
set
)
unfuseable_clients
:
UNFUSEABLE_MAPPING
=
defaultdict
(
set
)
for
out
,
clients
in
fg
.
clients
.
items
():
for
out
,
clients
in
fg
.
clients
.
items
():
# Old FunctionGraph nodes remain in the clients dictionary
# even after they are removed by rewrites
if
not
clients
:
continue
out_maybe_fuseable
=
(
out_maybe_fuseable
=
(
out
.
owner
out
.
owner
and
isinstance
(
out
.
owner
.
op
,
Elemwise
)
and
isinstance
(
out
.
owner
.
op
,
Elemwise
)
...
...
tests/tensor/rewriting/test_elemwise.py
浏览文件 @
a1a805c9
import
warnings
import
numpy
as
np
import
numpy
as
np
import
pytest
import
pytest
...
@@ -36,6 +38,7 @@ from pytensor.tensor.math import (
...
@@ -36,6 +38,7 @@ from pytensor.tensor.math import (
invert
,
invert
,
iround
,
iround
,
log
,
log
,
log1mexp
,
log2
,
log2
,
log10
,
log10
,
mul
,
mul
,
...
@@ -1370,6 +1373,21 @@ class TestFusion:
...
@@ -1370,6 +1373,21 @@ class TestFusion:
assert
benchmark
(
rewrite_func
)
==
103
assert
benchmark
(
rewrite_func
)
==
103
def
test_no_warning_from_old_client
(
self
):
# There used to be a warning issued when creating fuseable mapping
# for nodes that are no longer in the FunctionGraph
with
warnings
.
catch_warnings
():
warnings
.
simplefilter
(
"error"
)
# The -2 integer array cannot be passed directly to the C method
# of log1mexp as that can only handle floats. There is a rewrite
# that casts it to a float, but the FunctionGraph client retains
# the original log1mexp of the integer input, which caused
# a misleading warning for non C implementation in the FusionRewrite
assert
np
.
isclose
(
log1mexp
(
np
.
array
(
-
2
,
dtype
=
"int64"
))
.
eval
(),
np
.
log
(
1
-
np
.
exp
(
-
2
)),
)
class
TimesN
(
aes
.
basic
.
UnaryScalarOp
):
class
TimesN
(
aes
.
basic
.
UnaryScalarOp
):
"""
"""
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论