Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
36f94424
提交
36f94424
authored
4月 04, 2017
作者:
Frederic Bastien
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add the offset information in the memory profile
上级
df16dbcc
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
24 行增加
和
4 行删除
+24
-4
profiling.py
theano/compile/profiling.py
+16
-4
vm.py
theano/gof/vm.py
+8
-0
没有找到文件。
theano/compile/profiling.py
浏览文件 @
36f94424
...
@@ -89,6 +89,7 @@ def _atexit_print_fn():
...
@@ -89,6 +89,7 @@ def _atexit_print_fn():
# merge dictonary
# merge dictonary
for
attr
in
[
"apply_time"
,
"apply_callcount"
,
for
attr
in
[
"apply_time"
,
"apply_callcount"
,
"apply_cimpl"
,
"variable_shape"
,
"variable_strides"
,
"apply_cimpl"
,
"variable_shape"
,
"variable_strides"
,
"variable_offset"
,
"linker_make_thunk_time"
]:
"linker_make_thunk_time"
]:
cum_attr
=
getattr
(
cum
,
attr
)
cum_attr
=
getattr
(
cum
,
attr
)
for
key
,
val
in
iteritems
(
getattr
(
ps
,
attr
)):
for
key
,
val
in
iteritems
(
getattr
(
ps
,
attr
)):
...
@@ -229,6 +230,10 @@ class ProfileStats(object):
...
@@ -229,6 +230,10 @@ class ProfileStats(object):
# Variable -> strides
# Variable -> strides
#
#
variable_offset
=
{}
# Variable -> offset
#
optimizer_time
=
0.0
optimizer_time
=
0.0
# time spent optimizing graph (FunctionMaker.__init__)
# time spent optimizing graph (FunctionMaker.__init__)
...
@@ -295,6 +300,7 @@ class ProfileStats(object):
...
@@ -295,6 +300,7 @@ class ProfileStats(object):
self
.
apply_cimpl
=
{}
self
.
apply_cimpl
=
{}
self
.
variable_shape
=
{}
self
.
variable_shape
=
{}
self
.
variable_strides
=
{}
self
.
variable_strides
=
{}
self
.
variable_offset
=
{}
if
flag_time_thunks
is
None
:
if
flag_time_thunks
is
None
:
self
.
flag_time_thunks
=
config
.
profiling
.
time_thunks
self
.
flag_time_thunks
=
config
.
profiling
.
time_thunks
else
:
else
:
...
@@ -697,15 +703,21 @@ class ProfileStats(object):
...
@@ -697,15 +703,21 @@ class ProfileStats(object):
for
idx
,
var
in
enumerate
(
a
.
inputs
):
for
idx
,
var
in
enumerate
(
a
.
inputs
):
sh
=
self
.
variable_shape
.
get
(
var
,
'no shape'
)
sh
=
self
.
variable_shape
.
get
(
var
,
'no shape'
)
st
=
self
.
variable_strides
.
get
(
var
,
'no strides'
)
st
=
self
.
variable_strides
.
get
(
var
,
'no strides'
)
off
=
self
.
variable_offset
.
get
(
var
,
''
)
if
off
!=
''
:
off
=
", offset=
%
s"
%
off
dtype
=
getattr
(
var
,
'dtype'
,
'no dtype'
)
dtype
=
getattr
(
var
,
'dtype'
,
'no dtype'
)
print
(
" input
%
d: dtype=
%
s, shape=
%
s, strides=
%
s
"
%
(
print
(
" input
%
d: dtype=
%
s, shape=
%
s, strides=
%
s
%
s
"
%
(
idx
,
dtype
,
sh
,
st
),
file
=
file
)
idx
,
dtype
,
sh
,
st
,
off
),
file
=
file
)
for
idx
,
var
in
enumerate
(
a
.
outputs
):
for
idx
,
var
in
enumerate
(
a
.
outputs
):
sh
=
self
.
variable_shape
.
get
(
var
,
'no shape'
)
sh
=
self
.
variable_shape
.
get
(
var
,
'no shape'
)
st
=
self
.
variable_strides
.
get
(
var
,
'no strides'
)
st
=
self
.
variable_strides
.
get
(
var
,
'no strides'
)
off
=
self
.
variable_offset
.
get
(
var
,
''
)
if
off
!=
''
:
off
=
", offset=
%
s"
%
off
dtype
=
getattr
(
var
,
'dtype'
,
'no dtype'
)
dtype
=
getattr
(
var
,
'dtype'
,
'no dtype'
)
print
(
" output
%
d: dtype=
%
s, shape=
%
s, strides=
%
s
"
%
(
print
(
" output
%
d: dtype=
%
s, shape=
%
s, strides=
%
s
%
s
"
%
(
idx
,
dtype
,
sh
,
st
),
file
=
file
)
idx
,
dtype
,
sh
,
st
,
off
),
file
=
file
)
# Same as before, this I've sacrificied some information making
# Same as before, this I've sacrificied some information making
# the output more readable
# the output more readable
print
(
' ... (remaining
%
i Apply instances account for '
print
(
' ... (remaining
%
i Apply instances account for '
...
...
theano/gof/vm.py
浏览文件 @
36f94424
...
@@ -207,6 +207,7 @@ class VM(object):
...
@@ -207,6 +207,7 @@ class VM(object):
if
hasattr
(
self
,
'variable_shape'
):
if
hasattr
(
self
,
'variable_shape'
):
profile
.
variable_shape
=
self
.
variable_shape
.
copy
()
profile
.
variable_shape
=
self
.
variable_shape
.
copy
()
profile
.
variable_strides
=
self
.
variable_strides
.
copy
()
profile
.
variable_strides
=
self
.
variable_strides
.
copy
()
profile
.
variable_offset
=
self
.
variable_offset
.
copy
()
if
hasattr
(
self
,
'node_executed_order'
):
if
hasattr
(
self
,
'node_executed_order'
):
profile
.
node_executed_order
=
self
.
node_executed_order
[:]
profile
.
node_executed_order
=
self
.
node_executed_order
[:]
...
@@ -342,6 +343,7 @@ class Stack(VM):
...
@@ -342,6 +343,7 @@ class Stack(VM):
self
.
storage_map
=
storage_map
self
.
storage_map
=
storage_map
self
.
variable_shape
=
{}
# Variable -> shape
self
.
variable_shape
=
{}
# Variable -> shape
self
.
variable_strides
=
{}
# Variable -> strides
self
.
variable_strides
=
{}
# Variable -> strides
self
.
variable_offset
=
{}
# Variable -> offset
self
.
compute_map
=
compute_map
self
.
compute_map
=
compute_map
self
.
node_idx
=
node_idx
=
{}
self
.
node_idx
=
node_idx
=
{}
self
.
callback
=
callback
self
.
callback
=
callback
...
@@ -445,6 +447,8 @@ class Stack(VM):
...
@@ -445,6 +447,8 @@ class Stack(VM):
data
[
0
]
.
is_c_contiguous
()):
data
[
0
]
.
is_c_contiguous
()):
st
=
"c"
st
=
"c"
self
.
variable_strides
[
var
]
=
st
self
.
variable_strides
[
var
]
=
st
off
=
getattr
(
data
[
0
],
'offset'
,
''
)
self
.
variable_offset
[
var
]
=
off
while
apply_stack
:
while
apply_stack
:
# Make sure something happened last time round. This is
# Make sure something happened last time round. This is
...
@@ -506,6 +510,8 @@ class Stack(VM):
...
@@ -506,6 +510,8 @@ class Stack(VM):
data
[
0
]
.
is_c_contiguous
()):
data
[
0
]
.
is_c_contiguous
()):
st
=
"c"
st
=
"c"
self
.
variable_strides
[
var
]
=
st
self
.
variable_strides
[
var
]
=
st
off
=
getattr
(
o
[
0
],
'offset'
,
''
)
self
.
variable_offset
[
var
]
=
off
except
Exception
:
except
Exception
:
link
.
raise_with_op
(
link
.
raise_with_op
(
current_apply
,
current_apply
,
...
@@ -614,6 +620,8 @@ class Stack(VM):
...
@@ -614,6 +620,8 @@ class Stack(VM):
data
[
0
]
.
is_c_contiguous
()):
data
[
0
]
.
is_c_contiguous
()):
st
=
"c"
st
=
"c"
self
.
variable_strides
[
var
]
=
st
self
.
variable_strides
[
var
]
=
st
off
=
getattr
(
o
[
0
],
'offset'
,
''
)
self
.
variable_offset
[
var
]
=
off
input_index
=
[]
input_index
=
[]
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论