Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
fc4b41a7
提交
fc4b41a7
authored
8月 16, 2016
作者:
sentient07
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Added node created details
上级
eb3b6992
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
17 行增加
和
10 行删除
+17
-10
opt.py
theano/gof/opt.py
+17
-10
没有找到文件。
theano/gof/opt.py
浏览文件 @
fc4b41a7
...
...
@@ -341,7 +341,8 @@ class SeqOptimizer(Optimizer, list):
opts
[
i
]
.
local_opt
.
print_profile
(
stream
,
(
lo_g
.
time_opts
,
lo_g
.
time_nodes
,
lo_g
.
process_count
,
lo_g
.
applied_true
))
lo_g
.
applied_true
,
lo_g
.
node_created
))
print
(
file
=
stream
)
@staticmethod
...
...
@@ -1269,6 +1270,7 @@ class LocalOptGroup(LocalOptimizer):
self
.
time_nodes
=
{}
self
.
process_count
=
{}
self
.
applied_true
=
{}
self
.
node_created
=
{}
for
o
in
self
.
opts
:
self
.
process_count
.
setdefault
(
o
,
0
)
...
...
@@ -1276,6 +1278,8 @@ class LocalOptGroup(LocalOptimizer):
self
.
time_nodes
.
setdefault
(
o
,
0
)
self
.
process_count
.
setdefault
(
o
,
0
)
self
.
applied_true
.
setdefault
(
o
,
0
)
self
.
node_created
.
setdefault
(
o
,
0
)
for
c
in
o
.
tracks
():
self
.
track_map
.
setdefault
(
c
,
[])
.
append
(
o
)
...
...
@@ -1296,7 +1300,7 @@ class LocalOptGroup(LocalOptimizer):
if
len
(
self
.
opts
)
==
0
:
return
def
apply_mult_opts
(
node
,
multiple_opts
=
False
):
def
apply_mult_opts
(
node
,
fgraph
=
False
,
multiple_opts
=
False
):
repl
=
False
opts
=
self
.
track_map
.
get
(
type
(
node
.
op
),
[])
+
self
.
track_map
.
get
(
node
.
op
,
[])
+
self
.
track_map
.
get
(
None
,
[])
...
...
@@ -1309,6 +1313,7 @@ class LocalOptGroup(LocalOptimizer):
if
not
repl
:
continue
else
:
self
.
node_created
[
opt
]
+=
len
(
graph
.
ops
(
fgraph
.
variables
,
node
.
outputs
))
self
.
applied_true
[
opt
]
+=
1
if
not
multiple_opts
or
not
repl
[
0
]
.
owner
:
return
repl
...
...
@@ -1316,17 +1321,19 @@ class LocalOptGroup(LocalOptimizer):
# Ensuring not the input of graph
assert
repl
[
0
]
.
owner
new_node
=
repl
[
0
]
.
owner
apply_mult_opts
(
new_node
,
True
)
if
hasattr
(
new_node
,
'fgraph'
):
apply_mult_opts
(
new_node
,
new_node
.
fgraph
,
True
)
apply_mult_opts
(
new_node
,
False
,
True
)
return
repl
node_start
=
time
.
time
()
new_var
=
apply_mult_opts
(
node
,
self
.
apply_all_opts
)
new_var
=
apply_mult_opts
(
node
,
node
.
fgraph
,
self
.
apply_all_opts
)
node_finish
=
time
.
time
()
self
.
time_nodes
[
node
]
=
node_finish
-
node_start
return
new_var
@staticmethod
def
print_profile
(
stream
,
prof
,
level
=
0
):
(
time_opts
,
time_nodes
,
process_count
,
applied_true
)
=
prof
(
time_opts
,
time_nodes
,
process_count
,
applied_true
,
node_created
)
=
prof
blanc
=
(
' '
*
int
(
level
))
print
(
blanc
,
"LocalOptGroup"
,
file
=
stream
)
print
(
blanc
,
"---------------------"
,
file
=
stream
)
...
...
@@ -1335,18 +1342,18 @@ class LocalOptGroup(LocalOptimizer):
not_used_time
=
0
for
o
,
count
in
iteritems
(
process_count
):
if
count
>
0
:
count_opt
.
append
((
time_opts
[
o
],
applied_true
[
o
],
count
,
o
))
count_opt
.
append
((
time_opts
[
o
],
applied_true
[
o
],
count
,
o
,
node_created
[
o
]
))
else
:
not_used
.
append
((
time_opts
[
o
],
o
))
not_used_time
+=
time_opts
[
o
]
if
count_opt
:
print
(
blanc
,
' time taken - times applied - times tried - name:'
,
' time taken - times applied - times tried - name
- node_created
:'
,
file
=
stream
)
count_opt
.
sort
()
for
(
t
,
a_t
,
count
,
o
)
in
count_opt
[::
-
1
]:
print
(
blanc
,
'
%.3
fs -
%
d -
%
d -
%
s
'
%
(
t
,
a_t
,
count
,
o
),
file
=
stream
)
for
(
t
,
a_t
,
count
,
o
,
n_c
)
in
count_opt
[::
-
1
]:
print
(
blanc
,
'
%.3
fs -
%
d -
%
d -
%
s -
%
d
'
%
(
t
,
a_t
,
count
,
o
,
n_c
),
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
])))
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论