Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
80db2da2
提交
80db2da2
authored
7月 07, 2014
作者:
Hengjean
提交者:
Frederic
10月 21, 2014
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Updated current progress on same fgraph debug.
上级
a5ee246d
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
26 行增加
和
11 行删除
+26
-11
function_module.py
theano/compile/function_module.py
+26
-11
没有找到文件。
theano/compile/function_module.py
浏览文件 @
80db2da2
...
...
@@ -1091,17 +1091,19 @@ class FunctionMaker(object):
'''
graph_db and need_optimize
'''
try
:
f
=
open
(
graph_db_file
,
'r+b'
)
if
os
.
path
.
isfile
(
graph_db_file
):
print
'graph_db exists'
e
xcept
IOError
:
e
lse
:
# create graph_db
f
=
open
(
graph_db_file
,
'w+b'
)
print
'created new graph_db
%
s'
%
graph_db_file
print
'created new graph_db
%
s'
%
graph_db_file
f
.
close
# load the graph_db dictionary
try
:
f
=
open
(
graph_db_file
,
'r+b'
)
graph_db
=
pickle
.
load
(
f
)
f
.
close
()
print
'graph_db is not empty'
except
EOFError
,
e
:
# the file has nothing in it
...
...
@@ -1150,12 +1152,25 @@ class FunctionMaker(object):
t1
=
copy
.
deepcopy
(
output_new
)
t2
=
copy
.
deepcopy
(
output_old
)
# is_same_graph complains if fgraph is not None
del
t1
.
owner
.
fgraph
del
t2
.
owner
.
fgraph
del
t1
.
fgraph
del
t2
.
fgraph
flag
=
is_same_graph
(
t1
,
t2
,
givens
=
givens
)
def
removeAllFgraph
(
remove
):
if
hasattr
(
remove
,
'fgraph'
):
remove
.
fgraph
=
None
if
hasattr
(
remove
,
'owner'
):
if
remove
.
owner
==
None
:
remove
.
fgraph
=
None
else
:
if
hasattr
(
remove
.
owner
,
'fgraph'
):
remove
.
owner
.
fgraph
=
None
if
hasattr
(
remove
.
owner
,
'inputs'
):
remove
.
owner
.
inputs
=
[
removeAllFgraph
(
i
)
for
i
in
remove
.
owner
.
inputs
]
return
remove
t1
=
removeAllFgraph
(
t1
)
t2
=
removeAllFgraph
(
t2
)
flag
=
is_same_graph
(
t1
,
t2
,
givens
=
givens
)
flags
.
append
(
flag
)
is_same
=
all
(
flags
)
...
...
@@ -1183,16 +1198,16 @@ class FunctionMaker(object):
cPickle.load(test_file)
'''
graph_db
.
update
({
before_opt
:
fgraph
})
f
=
open
(
graph_db_file
,
'w+b'
)
pickle
.
dump
(
graph_db
,
f
,
-
1
)
f
.
close
()
print
'saved into graph_db'
else
:
print
'no opt, get graph from graph_db'
# just read the optmized graph from graph_db
opt_time
=
0
fgraph
=
graph_db
[
fgraph
]
# release stuff
f
.
close
()
release_lock
()
return
opt_time
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论