Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
3f60d13f
提交
3f60d13f
authored
4月 05, 2017
作者:
Reyhane Askari
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
changed flag name and minor change in fast_destroy
上级
4812ace3
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
14 行增加
和
14 行删除
+14
-14
configdefaults.py
theano/configdefaults.py
+2
-2
destroyhandler.py
theano/gof/destroyhandler.py
+12
-12
没有找到文件。
theano/configdefaults.py
浏览文件 @
3f60d13f
...
...
@@ -1478,10 +1478,10 @@ AddConfigVar('compile.wait',
IntParam
(
5
,
lambda
i
:
i
>
0
,
allow_override
=
False
),
in_c_key
=
False
)
AddConfigVar
(
'
disbale_
cycle_detection'
,
AddConfigVar
(
'cycle_detection'
,
"""If true it disables the cycle detection in graph.
"""
,
BoolParam
(
False
),
StrParam
(
'topo'
),
in_c_key
=
False
)
...
...
theano/gof/destroyhandler.py
浏览文件 @
3f60d13f
...
...
@@ -8,6 +8,7 @@ from __future__ import absolute_import, print_function, division
from
collections
import
deque
,
OrderedDict
from
six
import
iteritems
import
itertools
import
theano
from
theano
import
config
...
...
@@ -793,14 +794,14 @@ class DestroyHandler(toolbox.Bookkeeper): # noqa
dm
=
getattr
(
app
.
op
,
'destroy_map'
,
None
)
if
not
dm
:
return
# inputs = sum(dm.values()) # list of app's destroyed inputs
inputs
=
dm
.
values
()[
0
]
inputs
=
list
(
set
(
itertools
.
chain
.
from_iterable
(
dm
.
values
())))
# list of app's destroyed inputs
for
inp_idx
in
inputs
:
inp
=
app
.
inputs
[
inp_idx
]
if
inp
.
owner
:
if
len
(
inp
.
clients
)
>
1
:
self
.
fail_validate
=
theano
.
gof
.
InconsistencyError
(
"Destroyed variable has
too many clients
"
)
"Destroyed variable has
more than one client
"
)
else
:
app2
=
inp
.
owner
inp_idx2
=
app2
.
outputs
.
index
(
inp
)
...
...
@@ -810,7 +811,7 @@ class DestroyHandler(toolbox.Bookkeeper): # noqa
assert
len
(
dv
)
<=
1
if
len
(
v
)
>
0
:
self
.
fail_validate
=
theano
.
gof
.
InconsistencyError
(
"Destroyed variable has destroy_map
or view_map
"
)
"Destroyed variable has destroy_map"
)
def
on_import
(
self
,
fgraph
,
app
,
reason
):
"""
...
...
@@ -825,9 +826,8 @@ class DestroyHandler(toolbox.Bookkeeper): # noqa
# If it's a destructive op, add it to our watch list
if
getattr
(
app
.
op
,
'destroy_map'
,
{}):
# TODO: check here only one level of fast destroy_map.
self
.
destroyers
.
add
(
app
)
if
config
.
disbale_cycle_detection
:
if
config
.
cycle_detection
==
'fast'
:
self
.
fast_destroy
(
app
)
# add this symbol to the forward and backward maps
...
...
@@ -929,8 +929,7 @@ class DestroyHandler(toolbox.Bookkeeper): # noqa
self
.
view_o
.
setdefault
(
new_r
,
OrderedSet
())
.
add
(
output
)
# TODO: check here only one level of fast destroy_map.
if
config
.
disbale_cycle_detection
:
if
config
.
cycle_detection
==
'fast'
:
self
.
fast_destroy
(
app
)
self
.
stale_droot
=
True
...
...
@@ -944,10 +943,11 @@ class DestroyHandler(toolbox.Bookkeeper): # noqa
"""
if
self
.
destroyers
:
if
config
.
disbale_cycle_detection
and
self
.
fail_validate
:
self
.
fail_validate
=
False
# raise self.fail_validate
InconsistencyError
(
"error"
)
if
config
.
cycle_detection
==
'fast'
:
if
self
.
fail_validate
:
err
=
self
.
fail_validate
self
.
fail_validate
=
False
raise
err
ords
=
self
.
orderings
(
fgraph
)
if
_contains_cycle
(
fgraph
,
ords
):
raise
InconsistencyError
(
"Dependency graph contains cycles"
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论