Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
eb3b6992
提交
eb3b6992
authored
8月 15, 2016
作者:
sentient07
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Printing the used and tried opts
上级
841f4e49
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
17 行增加
和
8 行删除
+17
-8
opt.py
theano/gof/opt.py
+17
-8
没有找到文件。
theano/gof/opt.py
浏览文件 @
eb3b6992
...
...
@@ -340,7 +340,8 @@ class SeqOptimizer(Optimizer, list):
lo_g
=
opts
[
i
]
.
local_opt
opts
[
i
]
.
local_opt
.
print_profile
(
stream
,
(
lo_g
.
time_opts
,
lo_g
.
time_nodes
,
lo_g
.
process_count
))
lo_g
.
process_count
,
lo_g
.
applied_true
))
print
(
file
=
stream
)
@staticmethod
...
...
@@ -1267,10 +1268,14 @@ class LocalOptGroup(LocalOptimizer):
self
.
time_opts
=
{}
self
.
time_nodes
=
{}
self
.
process_count
=
{}
self
.
applied_true
=
{}
for
o
in
self
.
opts
:
self
.
process_count
.
setdefault
(
o
,
0
)
self
.
time_opts
.
setdefault
(
o
,
0
)
self
.
time_nodes
.
setdefault
(
o
,
0
)
self
.
process_count
.
setdefault
(
o
,
0
)
self
.
applied_true
.
setdefault
(
o
,
0
)
for
c
in
o
.
tracks
():
self
.
track_map
.
setdefault
(
c
,
[])
.
append
(
o
)
...
...
@@ -1293,7 +1298,7 @@ class LocalOptGroup(LocalOptimizer):
def
apply_mult_opts
(
node
,
multiple_opts
=
False
):
repl
=
False
opts
=
self
.
track_map
.
get
(
type
(
node
.
op
),
[])
+
self
.
track_map
.
get
(
node
.
op
,
[])
+
self
.
track_map
.
get
(
None
,
[])
opts
=
self
.
track_map
.
get
(
type
(
node
.
op
),
[])
+
self
.
track_map
.
get
(
node
.
op
,
[])
+
self
.
track_map
.
get
(
None
,
[])
for
opt
in
opts
:
opt_start
=
time
.
time
()
...
...
@@ -1304,6 +1309,7 @@ class LocalOptGroup(LocalOptimizer):
if
not
repl
:
continue
else
:
self
.
applied_true
[
opt
]
+=
1
if
not
multiple_opts
or
not
repl
[
0
]
.
owner
:
return
repl
assert
len
(
repl
)
==
1
...
...
@@ -1320,26 +1326,27 @@ class LocalOptGroup(LocalOptimizer):
@staticmethod
def
print_profile
(
stream
,
prof
,
level
=
0
):
(
time_opts
,
time_nodes
,
process_count
)
=
prof
(
time_opts
,
time_nodes
,
process_count
,
applied_true
)
=
prof
blanc
=
(
' '
*
int
(
level
))
print
(
blanc
,
"LocalOptGroup"
,
file
=
stream
)
print
(
blanc
,
"---------------------"
,
file
=
stream
)
count_opt
=
[]
not_used
=
[]
not_used_time
=
0
for
o
,
count
in
iteritems
(
process_count
):
if
count
>
0
:
count_opt
.
append
((
time_opts
[
o
],
count
,
o
))
count_opt
.
append
((
time_opts
[
o
],
applied_true
[
o
],
count
,
o
))
else
:
not_used
.
append
((
time_opts
[
o
],
o
))
not_used_time
+=
time_opts
[
o
]
if
count_opt
:
print
(
blanc
,
' time
s - times appl
ied - name:'
,
' time
taken - times applied - times tr
ied - name:'
,
file
=
stream
)
count_opt
.
sort
()
for
(
t
,
count
,
o
)
in
count_opt
[::
-
1
]:
print
(
blanc
,
'
%.3
fs -
%
d -
%
s'
%
(
t
,
count
,
o
),
file
=
stream
)
for
(
t
,
a_t
,
count
,
o
)
in
count_opt
[::
-
1
]:
print
(
blanc
,
'
%.3
fs -
%
d -
%
d -
%
s'
%
(
t
,
a_
t
,
count
,
o
),
file
=
stream
)
print
(
blanc
,
'
%.3
fs - in
%
d optimization that were not used (display those with runtime greater than 0)'
%
(
not_used_time
,
len
(
not_used
)),
file
=
stream
)
not_used
.
sort
(
key
=
lambda
nu
:
(
nu
[
0
],
str
(
nu
[
1
])))
...
...
@@ -1348,6 +1355,8 @@ class LocalOptGroup(LocalOptimizer):
# Skip opt that have 0 times, they probably wasn't even tried.
print
(
blanc
+
" "
,
'
%.3
fs -
%
s'
%
(
t
,
o
),
file
=
stream
)
print
(
file
=
stream
)
else
:
print
(
"--- The Optimizer wasn't successful ---"
)
def
print_summary
(
self
,
stream
=
sys
.
stdout
,
level
=
0
,
depth
=-
1
):
print
(
"
%
s
%
s id=
%
i"
%
(
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论