Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
4a8f5164
提交
4a8f5164
authored
5月 31, 2012
作者:
Frederic
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
put the profile in the env to allow better reuse of it later.
上级
79fd771a
显示空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
12 行增加
和
7 行删除
+12
-7
function_module.py
theano/compile/function_module.py
+2
-1
profiling.py
theano/compile/profiling.py
+4
-1
env.py
theano/gof/env.py
+1
-0
opt.py
theano/gof/opt.py
+3
-2
toolbox.py
theano/gof/toolbox.py
+2
-3
没有找到文件。
theano/compile/function_module.py
浏览文件 @
4a8f5164
...
@@ -1030,6 +1030,8 @@ class FunctionMaker(object):
...
@@ -1030,6 +1030,8 @@ class FunctionMaker(object):
# make the env (copies the graph, creates NEW INPUT AND OUTPUT VARIABLES)
# make the env (copies the graph, creates NEW INPUT AND OUTPUT VARIABLES)
env
,
additional_outputs
=
std_env
(
expanded_inputs
,
outputs
,
accept_inplace
)
env
,
additional_outputs
=
std_env
(
expanded_inputs
,
outputs
,
accept_inplace
)
env
.
profile
=
profile
self
.
env
=
env
self
.
env
=
env
# Fetch the optimizer and linker
# Fetch the optimizer and linker
...
@@ -1049,7 +1051,6 @@ class FunctionMaker(object):
...
@@ -1049,7 +1051,6 @@ class FunctionMaker(object):
mode
.
optimizer_time
+=
opt_time
mode
.
optimizer_time
+=
opt_time
if
profile
:
if
profile
:
profile
.
optimizer_time
+=
opt_time
profile
.
optimizer_time
+=
opt_time
profile
.
validate_time
+=
env
.
validate_time
_logger
.
debug
(
'Optimizing took
%
f seconds'
,
opt_time
)
_logger
.
debug
(
'Optimizing took
%
f seconds'
,
opt_time
)
#Add deep copy to respect the memory interface
#Add deep copy to respect the memory interface
...
...
theano/compile/profiling.py
浏览文件 @
4a8f5164
...
@@ -53,8 +53,11 @@ def _atexit_print_fn():
...
@@ -53,8 +53,11 @@ def _atexit_print_fn():
# for ps in [ps for ps in _atexit_print_list[1:]
# for ps in [ps for ps in _atexit_print_list[1:]
# if not isinstance(ps, ScanProfileStats)]:
# if not isinstance(ps, ScanProfileStats)]:
for
attr
in
[
"compile_time"
,
"fct_call_time"
,
"fct_callcount"
,
for
attr
in
[
"compile_time"
,
"fct_call_time"
,
"fct_callcount"
,
"vm_call_time"
,
"optimizer_time"
,
"linker_time"
]:
"vm_call_time"
,
"optimizer_time"
,
"linker_time"
,
"validate_time"
]:
setattr
(
cum
,
attr
,
getattr
(
cum
,
attr
)
+
getattr
(
ps
,
attr
))
setattr
(
cum
,
attr
,
getattr
(
cum
,
attr
)
+
getattr
(
ps
,
attr
))
#merge dictonary
for
attr
in
[
"apply_time"
,
"apply_callcount"
,
for
attr
in
[
"apply_time"
,
"apply_callcount"
,
"apply_cimpl"
,
"outputs_size"
]:
"apply_cimpl"
,
"outputs_size"
]:
cum_attr
=
getattr
(
cum
,
attr
)
cum_attr
=
getattr
(
cum
,
attr
)
...
...
theano/gof/env.py
浏览文件 @
4a8f5164
...
@@ -128,6 +128,7 @@ class Env(utils.object2):
...
@@ -128,6 +128,7 @@ class Env(utils.object2):
self
.
node_locks
=
{}
self
.
node_locks
=
{}
self
.
variable_locks
=
{}
self
.
variable_locks
=
{}
self
.
profile
=
None
### Setup a Variable ###
### Setup a Variable ###
...
...
theano/gof/opt.py
浏览文件 @
4a8f5164
...
@@ -154,7 +154,8 @@ class SeqOptimizer(Optimizer, list):
...
@@ -154,7 +154,8 @@ class SeqOptimizer(Optimizer, list):
Applies each L{Optimizer} in self in turn.
Applies each L{Optimizer} in self in turn.
"""
"""
l
=
[]
l
=
[]
validate_before
=
env
.
validate_time
if
env
.
profile
:
validate_before
=
env
.
profile
.
validate_time
nb_node_before
=
len
(
env
.
nodes
)
nb_node_before
=
len
(
env
.
nodes
)
for
optimizer
in
self
:
for
optimizer
in
self
:
try
:
try
:
...
@@ -176,7 +177,7 @@ class SeqOptimizer(Optimizer, list):
...
@@ -176,7 +177,7 @@ class SeqOptimizer(Optimizer, list):
elif
hasattr
(
self
,
"__name__"
):
print
self
.
__name__
,
elif
hasattr
(
self
,
"__name__"
):
print
self
.
__name__
,
print
" time
%.3
fs for
%
d/
%
d nodes before/after optimization"
%
(
sum
(
l
),
nb_node_before
,
len
(
env
.
nodes
))
print
" time
%.3
fs for
%
d/
%
d nodes before/after optimization"
%
(
sum
(
l
),
nb_node_before
,
len
(
env
.
nodes
))
print
" time
%.3
fs for validate "
%
(
print
" time
%.3
fs for validate "
%
(
env
.
validate_time
-
validate_before
)
env
.
profile
.
validate_time
-
validate_before
)
ll
=
[]
ll
=
[]
for
opt
in
self
:
for
opt
in
self
:
if
hasattr
(
opt
,
"__name__"
):
if
hasattr
(
opt
,
"__name__"
):
...
...
theano/gof/toolbox.py
浏览文件 @
4a8f5164
...
@@ -72,11 +72,11 @@ class Validator:
...
@@ -72,11 +72,11 @@ class Validator:
t0
=
time
.
time
()
t0
=
time
.
time
()
ret
=
env
.
execute_callbacks
(
'validate'
)
ret
=
env
.
execute_callbacks
(
'validate'
)
t1
=
time
.
time
()
t1
=
time
.
time
()
env
.
validate_time
+=
t1
-
t0
if
env
.
profile
:
env
.
profile
.
validate_time
+=
t1
-
t0
return
ret
return
ret
env
.
validate
=
validate
env
.
validate
=
validate
env
.
validate_time
=
0
def
consistent
():
def
consistent
():
try
:
try
:
...
@@ -89,7 +89,6 @@ class Validator:
...
@@ -89,7 +89,6 @@ class Validator:
def
on_detach
(
self
,
env
):
def
on_detach
(
self
,
env
):
del
env
.
validate
del
env
.
validate
del
env
.
consistent
del
env
.
consistent
del
env
.
validate_time
class
ReplaceValidate
(
History
,
Validator
):
class
ReplaceValidate
(
History
,
Validator
):
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论