Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
8db93fe1
提交
8db93fe1
authored
7月 18, 2022
作者:
Brandon T. Willard
提交者:
Brandon T. Willard
8月 17, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Rename CheckStackTraceOptimization to CheckStackTraceRewriter
上级
92a3b2a6
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
9 行增加
和
13 行删除
+9
-13
mode.py
aesara/compile/mode.py
+2
-2
opt.py
aesara/graph/opt.py
+7
-11
没有找到文件。
aesara/compile/mode.py
浏览文件 @
8db93fe1
...
...
@@ -11,7 +11,7 @@ from aesara.compile.function.types import Supervisor
from
aesara.configdefaults
import
config
from
aesara.graph.destroyhandler
import
DestroyHandler
from
aesara.graph.opt
import
(
CheckStackTrace
Optimization
,
CheckStackTrace
Rewriter
,
GraphRewriter
,
MergeOptimizer
,
NodeProcessingGraphRewriter
,
...
...
@@ -271,7 +271,7 @@ if config.check_stack_trace in ("raise", "warn", "log"):
if
config
.
check_stack_trace
==
"off"
:
_tags
=
()
optdb
.
register
(
"CheckStackTrace"
,
CheckStackTrace
Optimization
(),
*
_tags
,
position
=-
1
)
optdb
.
register
(
"CheckStackTrace"
,
CheckStackTrace
Rewriter
(),
*
_tags
,
position
=-
1
)
del
_tags
...
...
aesara/graph/opt.py
浏览文件 @
8db93fe1
...
...
@@ -3091,13 +3091,12 @@ def check_stack_trace(f_or_fgraph, ops_to_check="last", bug_print="raise"):
class
CheckStackTraceFeature
(
Feature
):
def
on_import
(
self
,
fgraph
,
node
,
reason
):
# In
optdb we only register the CheckStackTraceOptimization
when
#
config.check_stack_trace is not off
but we also double check here.
# In
`optdb` we only register the `CheckStackTraceRewriter`
when
#
`config.check_stack_trace` is not off,
but we also double check here.
if
config
.
check_stack_trace
!=
"off"
and
not
check_stack_trace
(
fgraph
,
"all"
):
if
config
.
check_stack_trace
==
"raise"
:
raise
AssertionError
(
"Empty stack trace! The optimization that inserted this variable is "
+
str
(
reason
)
f
"Empty stack trace. The rewrite that inserted this variable is {reason}."
)
elif
config
.
check_stack_trace
in
(
"log"
,
"warn"
):
apply_nodes_to_check
=
fgraph
.
apply_nodes
...
...
@@ -3109,22 +3108,19 @@ class CheckStackTraceFeature(Feature):
(
""
,
0
,
"Empty stack trace! The optimization that"
+
"inserted this variable is "
+
str
(
reason
),
f
"Empty stack trace. The rewrite that inserted this variable is {reason}."
,
""
,
)
]
]
if
config
.
check_stack_trace
==
"warn"
:
warnings
.
warn
(
"Empty stack trace! The optimization that inserted this variable is"
+
str
(
reason
)
f
"Empty stack trace. The rewrite that inserted this variable is {reason}."
)
class
CheckStackTrace
Optimization
(
GraphRewriter
):
"""
Optimizer that serves to add `CheckStackTraceOptimization
` as a feature."""
class
CheckStackTrace
Rewriter
(
GraphRewriter
):
"""
Rewriter that serves to add `CheckStackTraceRewriter
` as a feature."""
def
add_requirements
(
self
,
fgraph
):
if
not
hasattr
(
fgraph
,
"CheckStackTraceFeature"
):
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论