Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
928839ff
提交
928839ff
authored
10月 21, 2013
作者:
Frederic
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Make SeqOpt profile the validate time for each sub opt and the global callback time.
Don't make TopoOptimizer profile the validate time as this is not needed.
上级
08dd6e65
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
25 行增加
和
12 行删除
+25
-12
opt.py
theano/gof/opt.py
+25
-12
没有找到文件。
theano/gof/opt.py
浏览文件 @
928839ff
...
...
@@ -165,6 +165,10 @@ class SeqOptimizer(Optimizer, list):
l
=
[]
if
fgraph
.
profile
:
validate_before
=
fgraph
.
profile
.
validate_time
sub_validate_time
=
[
validate_before
]
else
:
sub_validate_time
=
[]
callback_before
=
fgraph
.
execute_callbacks_time
nb_node_before
=
len
(
fgraph
.
apply_nodes
)
sub_profs
=
[]
for
optimizer
in
self
:
...
...
@@ -173,6 +177,8 @@ class SeqOptimizer(Optimizer, list):
sub_prof
=
optimizer
.
optimize
(
fgraph
)
l
.
append
(
float
(
time
.
time
()
-
t0
))
sub_profs
.
append
(
sub_prof
)
if
fgraph
.
profile
:
sub_validate_time
.
append
(
fgraph
.
profile
.
validate_time
)
except
AssertionError
:
# do not catch Assertion failures
raise
...
...
@@ -187,8 +193,9 @@ class SeqOptimizer(Optimizer, list):
validate_time
=
fgraph
.
profile
.
validate_time
-
validate_before
else
:
validate_time
=
None
return
(
self
,
l
,
validate_time
,
nb_node_before
,
len
(
fgraph
.
apply_nodes
),
sub_profs
)
callback_time
=
fgraph
.
execute_callbacks_time
-
callback_before
return
(
self
,
l
,
validate_time
,
callback_time
,
nb_node_before
,
len
(
fgraph
.
apply_nodes
),
sub_profs
,
sub_validate_time
)
def
__str__
(
self
):
return
"SeqOpt(
%
s)"
%
list
.
__str__
(
self
)
...
...
@@ -208,8 +215,8 @@ class SeqOptimizer(Optimizer, list):
@staticmethod
def
print_profile
(
stream
,
prof
,
level
=
0
):
(
opts
,
prof
,
validate_time
,
nb_node_before
,
nb_node_after
,
sub_profs
)
=
prof
(
opts
,
prof
,
validate_time
,
callback_time
,
nb_node_before
,
nb_node_after
,
sub_profs
,
sub_validate_time
)
=
prof
blanc
=
(
' '
*
level
)
print
>>
stream
,
blanc
,
"SeqOptimizer"
,
...
...
@@ -222,8 +229,10 @@ class SeqOptimizer(Optimizer, list):
sum
(
prof
),
nb_node_before
,
nb_node_after
))
print
>>
stream
,
\
blanc
,
"
%.3
fs for fgraph.validate()"
%
(
validate_time
)
print
>>
stream
,
\
blanc
,
"
%.3
fs for callback"
%
(
callback_time
)
if
level
==
0
:
print
>>
stream
,
blanc
,
" time - (name, class, index)"
print
>>
stream
,
blanc
,
" time - (name, class, index)
- validate time
"
ll
=
[]
for
opt
in
opts
:
if
hasattr
(
opt
,
"__name__"
):
...
...
@@ -245,7 +254,14 @@ class SeqOptimizer(Optimizer, list):
for
(
t
,
opt
)
in
lll
[::
-
1
]:
#if t < 1:
# continue
print
>>
stream
,
blanc
,
'
%.6
fs -
%
s'
%
(
t
,
opt
)
if
sub_validate_time
:
i
=
opt
[
-
1
]
val_time
=
sub_validate_time
[
i
+
1
]
-
sub_validate_time
[
i
]
print
>>
stream
,
blanc
,
'
%.6
fs -
%
s -
%.3
fs'
%
(
t
,
opt
,
val_time
)
else
:
print
>>
stream
,
blanc
,
'
%.6
fs -
%
s'
%
(
t
,
opt
)
if
sub_profs
[
opt
[
-
1
]]:
opts
[
opt
[
-
1
]]
.
print_profile
(
stream
,
sub_profs
[
opt
[
-
1
]],
level
=
level
+
1
)
...
...
@@ -1313,7 +1329,6 @@ class TopoOptimizer(NavigatorOptimizer):
if
start_from
is
None
:
start_from
=
fgraph
.
outputs
callback_before
=
fgraph
.
execute_callbacks_time
validate_before
=
fgraph
.
profile
.
validate_time
nb_nodes_start
=
len
(
fgraph
.
apply_nodes
)
t0
=
time
.
time
()
q
=
deque
(
graph
.
io_toposort
(
fgraph
.
inputs
,
start_from
))
...
...
@@ -1348,15 +1363,14 @@ class TopoOptimizer(NavigatorOptimizer):
self
.
detach_updater
(
fgraph
,
u
)
callback_time
=
fgraph
.
execute_callbacks_time
-
callback_before
validate_time
=
fgraph
.
profile
.
validate_time
-
validate_before
nb_nodes_end
=
len
(
fgraph
.
apply_nodes
)
return
(
nb
,
nb_nodes_start
,
nb_nodes_end
,
io_t
,
loop_t
,
callback_time
,
validate_time
)
io_t
,
loop_t
,
callback_time
)
@staticmethod
def
print_profile
(
stream
,
prof
,
level
=
0
):
(
nb
,
io_t
,
nb_nodes_start
,
nb_nodes_end
,
loop_t
,
callback_time
,
validate
_time
)
=
prof
(
nb
,
nb_nodes_start
,
nb_nodes_end
,
io_t
,
loop_t
,
callback
_time
)
=
prof
blanc
=
(
' '
*
level
)
print
>>
stream
,
blanc
,
"TopoOptimizer"
...
...
@@ -1365,7 +1379,6 @@ class TopoOptimizer(NavigatorOptimizer):
print
>>
stream
,
blanc
,
" init io_toposort"
,
io_t
print
>>
stream
,
blanc
,
" loop time"
,
loop_t
print
>>
stream
,
blanc
,
" callback_time"
,
callback_time
print
>>
stream
,
blanc
,
" validate_time"
,
validate_time
def
__str__
(
self
):
return
getattr
(
self
,
'__name__'
,
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论