Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
8ad02e51
提交
8ad02e51
authored
6月 12, 2017
作者:
Reyhane Askari
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
removed outputguard when cycle_detection is fast(commit mostly removed after a rebase)
上级
2f8e387a
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
4 行增加
和
15 行删除
+4
-15
ops.py
theano/compile/ops.py
+1
-0
destroyhandler.py
theano/gof/destroyhandler.py
+3
-15
没有找到文件。
theano/compile/ops.py
浏览文件 @
8ad02e51
...
@@ -120,6 +120,7 @@ class OutputGuard(ViewOp):
...
@@ -120,6 +120,7 @@ class OutputGuard(ViewOp):
"""
"""
destroy_map
=
{
0
:
[
0
]}
destroy_map
=
{
0
:
[
0
]}
view_map
=
{}
check_input
=
False
check_input
=
False
...
...
theano/gof/destroyhandler.py
浏览文件 @
8ad02e51
...
@@ -446,7 +446,7 @@ class DestroyHandler(toolbox.Bookkeeper): # noqa
...
@@ -446,7 +446,7 @@ class DestroyHandler(toolbox.Bookkeeper): # noqa
delattr
(
self
.
fgraph
,
'destroy_handler'
)
delattr
(
self
.
fgraph
,
'destroy_handler'
)
self
.
fgraph
=
None
self
.
fgraph
=
None
def
fast_destroy
(
self
,
app
,
reason
,
full
=
False
):
def
fast_destroy
(
self
,
app
,
reason
):
"""
"""
Do the check for only 1 level.
Do the check for only 1 level.
...
@@ -457,7 +457,6 @@ class DestroyHandler(toolbox.Bookkeeper): # noqa
...
@@ -457,7 +457,6 @@ class DestroyHandler(toolbox.Bookkeeper): # noqa
- But don't allow to destroy view
- But don't allow to destroy view
"""
"""
dm
=
getattr
(
app
.
op
,
'destroy_map'
,
None
)
dm
=
getattr
(
app
.
op
,
'destroy_map'
,
None
)
vm
=
getattr
(
app
.
op
,
'view_map'
,
{})
if
not
dm
:
if
not
dm
:
return
return
inputs
=
set
(
itertools
.
chain
.
from_iterable
(
dm
.
values
()))
# list of app's destroyed inputs
inputs
=
set
(
itertools
.
chain
.
from_iterable
(
dm
.
values
()))
# list of app's destroyed inputs
...
@@ -491,17 +490,6 @@ class DestroyHandler(toolbox.Bookkeeper): # noqa
...
@@ -491,17 +490,6 @@ class DestroyHandler(toolbox.Bookkeeper): # noqa
# assert len(v) <= 1
# assert len(v) <= 1
# assert len(d) <= 1
# assert len(d) <= 1
# We don't want this to be a regular check. Full is only enabled when a node is
# attached to the graph and at the end of validation. We check a rare case where
# an apply node has a dmap and vmap on the same input. Right now the only case
# of this pattern is when app is the OutputGuard.
if
full
:
d_inputs
=
set
(
dmap
for
sublist
in
dm
.
values
()
for
dmap
in
sublist
)
v_inputs
=
set
(
vmap
for
sublist
in
vm
.
values
()
for
vmap
in
sublist
)
if
d_inputs
.
intersection
(
v_inputs
):
self
.
fail_validate
[
app
]
=
theano
.
gof
.
InconsistencyError
(
"
\
Destroyed variable has both view_map and destroy_map. "
+
str
(
reason
))
def
on_import
(
self
,
fgraph
,
app
,
reason
):
def
on_import
(
self
,
fgraph
,
app
,
reason
):
"""
"""
Add Apply instance to set which must be computed.
Add Apply instance to set which must be computed.
...
@@ -518,7 +506,7 @@ class DestroyHandler(toolbox.Bookkeeper): # noqa
...
@@ -518,7 +506,7 @@ class DestroyHandler(toolbox.Bookkeeper): # noqa
if
dmap
:
if
dmap
:
self
.
destroyers
.
add
(
app
)
self
.
destroyers
.
add
(
app
)
if
self
.
algo
==
'fast'
:
if
self
.
algo
==
'fast'
:
self
.
fast_destroy
(
app
,
reason
,
full
=
True
)
self
.
fast_destroy
(
app
,
reason
)
# add this symbol to the forward and backward maps
# add this symbol to the forward and backward maps
for
o_idx
,
i_idx_list
in
iteritems
(
vmap
):
for
o_idx
,
i_idx_list
in
iteritems
(
vmap
):
...
@@ -650,7 +638,7 @@ class DestroyHandler(toolbox.Bookkeeper): # noqa
...
@@ -650,7 +638,7 @@ class DestroyHandler(toolbox.Bookkeeper): # noqa
# double check here.
# double check here.
for
app
in
app_err_pairs
:
for
app
in
app_err_pairs
:
if
app
in
fgraph
.
apply_nodes
:
if
app
in
fgraph
.
apply_nodes
:
self
.
fast_destroy
(
app
,
'validate'
,
full
=
True
)
self
.
fast_destroy
(
app
,
'validate'
)
if
self
.
fail_validate
:
if
self
.
fail_validate
:
self
.
fail_validate
=
app_err_pairs
self
.
fail_validate
=
app_err_pairs
raise
app_err_pairs
[
app
]
raise
app_err_pairs
[
app
]
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论