Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
73f7b1ce
提交
73f7b1ce
authored
10月 08, 2015
作者:
Frederic
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Make the merge op in canonicalize eq a local opt to now make all merge work there
上级
599995d0
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
18 行增加
和
3 行删除
+18
-3
opt.py
theano/gof/opt.py
+2
-0
opt.py
theano/tensor/opt.py
+16
-3
没有找到文件。
theano/gof/opt.py
浏览文件 @
73f7b1ce
...
@@ -1773,6 +1773,8 @@ class NavigatorOptimizer(Optimizer):
...
@@ -1773,6 +1773,8 @@ class NavigatorOptimizer(Optimizer):
raise
raise
if
replacements
is
False
or
replacements
is
None
:
if
replacements
is
False
or
replacements
is
None
:
return
False
return
False
if
replacements
is
True
:
return
True
old_vars
=
node
.
outputs
old_vars
=
node
.
outputs
if
isinstance
(
replacements
,
dict
):
if
isinstance
(
replacements
,
dict
):
old_vars
=
list
(
replacements
.
keys
())
old_vars
=
list
(
replacements
.
keys
())
...
...
theano/tensor/opt.py
浏览文件 @
73f7b1ce
...
@@ -504,9 +504,22 @@ def register_specialize_device(lopt, *tags, **kwargs):
...
@@ -504,9 +504,22 @@ def register_specialize_device(lopt, *tags, **kwargs):
return
lopt
return
lopt
# Register merge_optimizer as a global opt during canonicalize
# Register in the canonizer Equilibrium as a local opt the merge opt.
compile
.
optdb
[
'canonicalize'
]
.
register
(
'canon_merge'
,
merge_optimizer
,
# Without this, as the equilibrium have ignore_newtrees=False, we
'fast_run'
,
final_opt
=
True
)
# won't merge all nodes if it is set as a global optimizer with
# final_opt=True.
#
# This work due to those properties:
# 1) the EQ will execute first the optimizer that trac all nodes.
# 2) after an local optimization being applied, if the
# current node is still in the graph, it will continue to the next
# local optimizer. So this won't trigger more iteration.
@register_canonicalize
(
'fast_compile'
,
'merge'
)
@gof.local_optimizer
(
None
)
def
local_merge_optimizer
(
node
):
if
node
.
fgraph
.
merge_feature
.
scheduled
:
ret
=
merge_optimizer
(
node
.
fgraph
)
return
ret
[
5
]
>
0
#####################
#####################
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论