Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
01c99eea
提交
01c99eea
authored
4月 04, 2017
作者:
notoraptor
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Also print compiled set of ops.
Try to make printing more readable.
上级
aa98984b
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
33 行增加
和
14 行删除
+33
-14
compiledir.py
theano/gof/compiledir.py
+33
-14
没有找到文件。
theano/gof/compiledir.py
浏览文件 @
01c99eea
...
@@ -93,6 +93,15 @@ def cleanup():
...
@@ -93,6 +93,15 @@ def cleanup():
file
.
close
()
file
.
close
()
def
print_title
(
title
,
overline
=
''
,
underline
=
''
):
len_title
=
len
(
title
)
if
overline
:
print
(
str
(
overline
)
*
len_title
)
print
(
title
)
if
underline
:
print
(
str
(
underline
)
*
len_title
)
def
print_compiledir_content
():
def
print_compiledir_content
():
"""
"""
print list of
%
d compiled individual ops in the "theano.config.compiledir"
print list of
%
d compiled individual ops in the "theano.config.compiledir"
...
@@ -101,8 +110,8 @@ def print_compiledir_content():
...
@@ -101,8 +110,8 @@ def print_compiledir_content():
compiledir
=
theano
.
config
.
compiledir
compiledir
=
theano
.
config
.
compiledir
table
=
[]
table
=
[]
table_multiple_ops
=
[]
table_op_class
=
{}
table_op_class
=
{}
more_than_one_ops
=
0
zeros_op
=
0
zeros_op
=
0
big_key_files
=
[]
big_key_files
=
[]
total_key_sizes
=
0
total_key_sizes
=
0
...
@@ -122,8 +131,6 @@ def print_compiledir_content():
...
@@ -122,8 +131,6 @@ def print_compiledir_content():
table_op_class
[
op_class
]
+=
1
table_op_class
[
op_class
]
+=
1
if
len
(
ops
)
==
0
:
if
len
(
ops
)
==
0
:
zeros_op
+=
1
zeros_op
+=
1
elif
len
(
ops
)
>
1
:
more_than_one_ops
+=
1
else
:
else
:
types
=
list
(
set
([
x
for
x
in
flatten
(
keydata
.
keys
)
types
=
list
(
set
([
x
for
x
in
flatten
(
keydata
.
keys
)
if
isinstance
(
x
,
theano
.
gof
.
Type
)]))
if
isinstance
(
x
,
theano
.
gof
.
Type
)]))
...
@@ -136,7 +143,12 @@ def print_compiledir_content():
...
@@ -136,7 +143,12 @@ def print_compiledir_content():
compile_end
=
os
.
path
.
getmtime
(
compile_end
=
os
.
path
.
getmtime
(
os
.
path
.
join
(
compiledir
,
dir
,
fn
))
os
.
path
.
join
(
compiledir
,
dir
,
fn
))
compile_time
=
compile_end
-
compile_start
compile_time
=
compile_end
-
compile_start
table
.
append
((
dir
,
ops
[
0
],
types
,
compile_time
))
if
len
(
ops
)
==
1
:
table
.
append
((
dir
,
ops
[
0
],
types
,
compile_time
))
else
:
ops_to_str
=
'[
%
s]'
%
', '
.
join
(
sorted
(
str
(
op
)
for
op
in
ops
))
types_to_str
=
'[
%
s]'
%
', '
.
join
(
sorted
(
str
(
t
)
for
t
in
types
))
table_multiple_ops
.
append
((
dir
,
ops_to_str
,
types_to_str
,
compile_time
))
size
=
os
.
path
.
getsize
(
filename
)
size
=
os
.
path
.
getsize
(
filename
)
total_key_sizes
+=
size
total_key_sizes
+=
size
...
@@ -148,16 +160,25 @@ def print_compiledir_content():
...
@@ -148,16 +160,25 @@ def print_compiledir_content():
except
IOError
:
except
IOError
:
pass
pass
print
(
"List of
%
d compiled individual ops in this theano cache
%
s:"
%
(
print_title
(
"Theano cache:
%
s"
%
compiledir
,
overline
=
'='
,
underline
=
'='
)
len
(
table
),
compiledir
))
print
()
print
(
"sub dir/compiletime/Op/set of different associated Theano types"
)
print_title
(
"List of
%
d compiled individual ops"
%
len
(
table
),
underline
=
'+'
)
print_title
(
"sub dir/compiletime/Op/set of different associated Theano types"
,
underline
=
'-'
)
table
=
sorted
(
table
,
key
=
lambda
t
:
str
(
t
[
1
]))
table
=
sorted
(
table
,
key
=
lambda
t
:
str
(
t
[
1
]))
for
dir
,
op
,
types
,
compile_time
in
table
:
for
dir
,
op
,
types
,
compile_time
in
table
:
print
(
dir
,
'
%.3
fs'
%
compile_time
,
op
,
types
)
print
(
dir
,
'
%.3
fs'
%
compile_time
,
op
,
types
)
print
()
print
()
print
((
"List of
%
d compiled Op classes and "
print_title
(
"List of
%
d compiled sets of ops"
%
len
(
table_multiple_ops
),
underline
=
'+'
)
"the number of times they got compiled"
%
len
(
table_op_class
)))
print_title
(
"sub dir/compiletime/Set of ops/set of different associated Theano types"
,
underline
=
'-'
)
table_multiple_ops
=
sorted
(
table_multiple_ops
,
key
=
lambda
t
:
(
t
[
1
],
t
[
2
]))
for
dir
,
ops_to_str
,
types_to_str
,
compile_time
in
table_multiple_ops
:
print
(
dir
,
'
%.3
fs'
%
compile_time
,
ops_to_str
,
types_to_str
)
print
()
print_title
((
"List of
%
d compiled Op classes and "
"the number of times they got compiled"
%
len
(
table_op_class
)),
underline
=
'+'
)
table_op_class
=
sorted
(
iteritems
(
table_op_class
),
key
=
lambda
t
:
t
[
1
])
table_op_class
=
sorted
(
iteritems
(
table_op_class
),
key
=
lambda
t
:
t
[
1
])
for
op_class
,
nb
in
table_op_class
:
for
op_class
,
nb
in
table_op_class
:
print
(
op_class
,
nb
)
print
(
op_class
,
nb
)
...
@@ -176,13 +197,11 @@ def print_compiledir_content():
...
@@ -176,13 +197,11 @@ def print_compiledir_content():
nb_keys
=
sorted
(
iteritems
(
nb_keys
))
nb_keys
=
sorted
(
iteritems
(
nb_keys
))
print
()
print
()
print
(
"Number of keys for a compiled module"
)
print
_title
(
"Number of keys for a compiled module"
,
underline
=
'+'
)
print
(
"number of keys/number of modules with that number of keys"
)
print
_title
(
"number of keys/number of modules with that number of keys"
,
underline
=
'-'
)
for
n_k
,
n_m
in
nb_keys
:
for
n_k
,
n_m
in
nb_keys
:
print
(
n_k
,
n_m
)
print
(
n_k
,
n_m
)
print
()
print
((
"Skipped
%
d files that contained more than"
" 1 op (was compiled with the C linker)"
%
more_than_one_ops
))
print
((
"Skipped
%
d files that contained 0 op "
print
((
"Skipped
%
d files that contained 0 op "
"(are they always theano.scalar ops?)"
%
zeros_op
))
"(are they always theano.scalar ops?)"
%
zeros_op
))
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论