Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
5529c62f
提交
5529c62f
authored
10月 15, 2013
作者:
Frederic Bastien
提交者:
Frederic
10月 18, 2013
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Print the flops with the memory profiler.
上级
11c4882a
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
36 行增加
和
0 行删除
+36
-0
profiling.py
theano/compile/profiling.py
+17
-0
conv.py
theano/tensor/nnet/conv.py
+19
-0
没有找到文件。
theano/compile/profiling.py
浏览文件 @
5529c62f
...
@@ -532,6 +532,12 @@ class ProfileStats(object):
...
@@ -532,6 +532,12 @@ class ProfileStats(object):
hs
+=
[
'<id>'
]
hs
+=
[
'<id>'
]
es
+=
[
'
%3
d'
]
es
+=
[
'
%3
d'
]
if
self
.
variable_shape
:
hs
+=
[
'<Mflops>'
]
es
+=
[
'
%.1
f'
]
else
:
es
+=
[
'
%
s'
]
upto_length
=
numpy
.
sum
([
len
(
x
)
for
x
in
hs
])
+
len
(
hs
)
upto_length
=
numpy
.
sum
([
len
(
x
)
for
x
in
hs
])
+
len
(
hs
)
maxlen
=
self
.
line_width
-
upto_length
maxlen
=
self
.
line_width
-
upto_length
hs
+=
[
'<Apply name>'
]
hs
+=
[
'<Apply name>'
]
...
@@ -557,8 +563,19 @@ class ProfileStats(object):
...
@@ -557,8 +563,19 @@ class ProfileStats(object):
ftot
=
tot
*
100
/
local_time
ftot
=
tot
*
100
/
local_time
if
nb_call
==
0
:
if
nb_call
==
0
:
continue
continue
if
not
self
.
variable_shape
:
flops
=
""
elif
hasattr
(
a
.
op
,
'flops'
):
flops
=
a
.
op
.
flops
([
self
.
variable_shape
[
var
]
for
var
in
a
.
inputs
],
[
self
.
variable_shape
[
var
]
for
var
in
a
.
outputs
])
flops
=
flops
/
1024.
/
1024
else
:
flops
=
-
1
print
>>
file
,
format_str
%
(
f
,
ftot
,
t
,
t
/
nb_call
,
nb_call
,
print
>>
file
,
format_str
%
(
f
,
ftot
,
t
,
t
/
nb_call
,
nb_call
,
nd_id
,
nd_id
,
flops
,
str
(
a
)[:
maxlen
])
str
(
a
)[:
maxlen
])
if
not
config
.
profile_memory
:
if
not
config
.
profile_memory
:
continue
continue
...
...
theano/tensor/nnet/conv.py
浏览文件 @
5529c62f
...
@@ -605,6 +605,25 @@ class ConvOp(OpenMPOp):
...
@@ -605,6 +605,25 @@ class ConvOp(OpenMPOp):
self
.
kshp
[
0
]
*
self
.
kshp
[
1
]
*
\
self
.
kshp
[
0
]
*
self
.
kshp
[
1
]
*
\
self
.
imshp
[
1
]
*
self
.
imshp
[
2
]
*
2
self
.
imshp
[
1
]
*
self
.
imshp
[
2
]
*
2
def
flops
(
self
,
inputs
,
outputs
):
""" Useful with the hack in profilemode to print the MFlops"""
images
,
kerns
=
inputs
out
,
=
outputs
assert
images
[
1
]
==
kerns
[
1
]
flops
=
0
if
self
.
out_mode
==
"valid"
:
# nb mul and add by output pixed
flops
=
kerns
[
2
]
*
kerns
[
3
]
*
2
#nb flops by output image
flops
*=
out
[
2
]
*
out
[
3
]
# for all outputs images#n_stack==self.imshp[0]
flops
*=
images
[
1
]
*
kerns
[
0
]
*
images
[
0
]
else
:
# full mode not implemented
flops
=
(
images
[
0
]
*
kerns
[
0
]
*
images
[
1
]
*
kerns
[
2
]
*
kerns
[
3
]
*
images
[
2
]
*
images
[
3
]
*
2
)
return
flops
def
make_node
(
self
,
inputs
,
kerns
):
def
make_node
(
self
,
inputs
,
kerns
):
# TODO: find a way to make ConvOp work for N-D (after NIPS09)
# TODO: find a way to make ConvOp work for N-D (after NIPS09)
"""
"""
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论