Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
b2a07f3f
提交
b2a07f3f
authored
11月 07, 2013
作者:
Frederic
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add profile to witch feature is taking time.
上级
e738777f
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
17 行增加
和
4 行删除
+17
-4
fg.py
theano/gof/fg.py
+4
-2
opt.py
theano/gof/opt.py
+13
-2
没有找到文件。
theano/gof/fg.py
浏览文件 @
b2a07f3f
...
...
@@ -93,6 +93,7 @@ class FunctionGraph(utils.object2):
inputs
,
outputs
=
graph
.
clone
(
inputs
,
outputs
)
self
.
execute_callbacks_time
=
0
self
.
execute_callbacks_times
=
{}
if
features
is
None
:
features
=
[]
...
...
@@ -507,7 +508,7 @@ class FunctionGraph(utils.object2):
attach
(
self
)
except
toolbox
.
AlreadyThere
:
return
self
.
execute_callbacks_times
.
setdefault
(
feature
,
0
)
#it would be nice if we could require a specific class instead of
#a "workalike" so we could do actual error checking
#if not isinstance(feature, toolbox.Feature):
...
...
@@ -549,8 +550,9 @@ class FunctionGraph(utils.object2):
# try; the AttributeError reall must come from feature.${name}
# not existing
continue
tf0
=
time
.
time
()
fn
(
self
,
*
args
,
**
kwargs
)
self
.
execute_callbacks_times
[
feature
]
+=
time
.
time
()
-
tf0
self
.
execute_callbacks_time
+=
time
.
time
()
-
t0
def
collect_callbacks
(
self
,
name
,
*
args
):
...
...
theano/gof/opt.py
浏览文件 @
b2a07f3f
...
...
@@ -566,6 +566,8 @@ class MergeOptimizer(Optimizer):
if
fgraph
.
profile
:
validate_before
=
fgraph
.
profile
.
validate_time
callback_before
=
fgraph
.
execute_callbacks_time
callbacks_before
=
fgraph
.
execute_callbacks_times
.
copy
()
nb_merged
=
0
nb_constant
=
0
while
sched
:
...
...
@@ -589,20 +591,28 @@ class MergeOptimizer(Optimizer):
if
fgraph
.
profile
:
validate_time
=
fgraph
.
profile
.
validate_time
-
validate_before
callback_time
=
fgraph
.
execute_callbacks_time
-
callback_before
callbacks_time
=
{}
for
k
,
v
in
fgraph
.
execute_callbacks_times
.
iteritems
():
if
k
in
callbacks_before
:
callbacks_time
[
k
]
=
v
-
callbacks_before
[
k
]
else
:
callbacks_time
[
k
]
=
v
else
:
validate_time
=
None
callback_time
=
None
callbacks_time
=
{}
# clear blacklist
fgraph
.
merge_feature
.
blacklist
=
[]
return
(
nb_fail
,
time
.
time
()
-
t0
,
validate_time
,
callback_time
,
nb_merged
,
nb_constant
)
callback_time
,
callbacks_time
,
nb_merged
,
nb_constant
)
def
__str__
(
self
):
return
self
.
__class__
.
__name__
@staticmethod
def
print_profile
(
stream
,
prof
,
level
=
0
):
nb_fail
,
replace_time
,
validate_time
,
callback_time
,
nb_merged
,
nb_constant
=
prof
(
nb_fail
,
replace_time
,
validate_time
,
callback_time
,
callbacks_time
,
nb_merged
,
nb_constant
)
=
prof
blanc
=
(
' '
*
level
)
print
>>
stream
,
blanc
,
"MergeOptimizer"
...
...
@@ -610,6 +620,7 @@ class MergeOptimizer(Optimizer):
print
>>
stream
,
blanc
,
" replace_time"
,
replace_time
print
>>
stream
,
blanc
,
" validate_time"
,
validate_time
print
>>
stream
,
blanc
,
" callback_time"
,
callback_time
print
>>
stream
,
blanc
,
" callback_times"
,
callbacks_time
print
>>
stream
,
blanc
,
" nb_merged"
,
nb_merged
print
>>
stream
,
blanc
,
" nb_constant"
,
nb_constant
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论