Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
7192820f
提交
7192820f
authored
3月 27, 2013
作者:
Frederic
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Added comments and FIX the order or execution of nodes!
This is in profile_memory.
上级
538af73c
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
10 行增加
和
9 行删除
+10
-9
profiling.py
theano/compile/profiling.py
+10
-9
没有找到文件。
theano/compile/profiling.py
浏览文件 @
7192820f
...
...
@@ -588,7 +588,7 @@ class ProfileStats(object):
assert
self
.
validate_time
<
self
.
optimizer_time
def
summary_memory
(
self
,
file
,
N
=
None
):
fct_memory
=
{}
# fgraph->dict(node->
(outputs size)
)
fct_memory
=
{}
# fgraph->dict(node->
[outputs size]
)
fct_shapes
=
{}
# fgraph->dict(node->[outputs shapes]))
var_mem
=
{}
# varible->size in bytes; don't include input variables
node_mem
=
{}
# node->total outputs size
...
...
@@ -610,7 +610,7 @@ class ProfileStats(object):
fct_shapes
[
node
.
fgraph
][
node
]
.
append
(
sh
)
node_mem
[
node
]
=
sum
([
var_mem
[
var
]
for
var
in
node
.
outputs
])
#Find the function that used the most
memory
#Find the function that used the most
of that statistic
max_sum_size
=
0
max_node_memory_size
=
0
max_running_memory_size
=
0
...
...
@@ -635,12 +635,12 @@ class ProfileStats(object):
# The maximum of running_memory_size during the function
running_max_memory_size
=
0
post_thunk_old_storage
=
[]
items
=
nodes_mem
.
items
()
items
.
sort
(
key
=
lambda
a
:
a
[
1
])
items
.
reverse
()
order
=
fgraph
.
toposort
()
# A list of intermediate variable that are not need
# after the execution of the corresponding node.
# It mean that after executing the node,
# the corresponding variable can be gc.
post_thunk_old_storage
=
[]
computed
,
last_user
=
theano
.
gof
.
link
.
gc_helper
(
order
)
for
node
in
order
:
post_thunk_old_storage
.
append
([
...
...
@@ -649,7 +649,8 @@ class ProfileStats(object):
if
(
input
in
computed
)
and
(
input
not
in
fgraph
.
outputs
)
and
node
==
last_user
[
input
]])
for
node
,
val
in
items
:
for
node
in
order
:
val
=
nodes_mem
[
node
]
dmap
=
getattr
(
node
.
op
,
'destroy_map'
,
None
)
vmap
=
getattr
(
node
.
op
,
'view_map'
,
None
)
...
...
@@ -680,7 +681,7 @@ class ProfileStats(object):
node_memory_saved_by_view
)
max_node_memory_saved_by_inplace
=
max
(
max_node_memory_saved_by_inplace
,
node_memory_saved_by_inplace
)
del
fgraph
,
nodes_mem
,
items
,
post_thunk_old_storage
,
node
del
fgraph
,
nodes_mem
,
post_thunk_old_storage
,
node
if
len
(
fct_memory
)
>
1
:
print
>>
file
,
(
"Memory Profile "
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论