Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
08e5dab2
提交
08e5dab2
authored
2月 09, 2015
作者:
Frederic Bastien
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add profile of theano.grad
上级
43875391
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
12 行增加
和
0 行删除
+12
-0
profiling.py
theano/compile/profiling.py
+4
-0
gradient.py
theano/gradient.py
+8
-0
没有找到文件。
theano/compile/profiling.py
浏览文件 @
08e5dab2
...
@@ -654,6 +654,9 @@ class ProfileStats(object):
...
@@ -654,6 +654,9 @@ class ProfileStats(object):
# The validation time is a subset of optimizer_time
# The validation time is a subset of optimizer_time
assert
self
.
validate_time
<
self
.
optimizer_time
assert
self
.
validate_time
<
self
.
optimizer_time
def
summary_globals
(
self
,
file
):
print
>>
file
,
'Time in all call to theano.grad()
%
es'
%
theano
.
gradient
.
grad_time
def
summary_memory
(
self
,
file
,
N
=
None
):
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]))
fct_shapes
=
{}
# fgraph->dict(node->[outputs shapes]))
...
@@ -1209,6 +1212,7 @@ class ProfileStats(object):
...
@@ -1209,6 +1212,7 @@ class ProfileStats(object):
def
summary
(
self
,
file
=
sys
.
stderr
,
n_ops_to_print
=
20
,
def
summary
(
self
,
file
=
sys
.
stderr
,
n_ops_to_print
=
20
,
n_apply_to_print
=
20
):
n_apply_to_print
=
20
):
self
.
summary_function
(
file
)
self
.
summary_function
(
file
)
self
.
summary_globals
(
file
)
local_time
=
sum
(
self
.
apply_time
.
values
())
local_time
=
sum
(
self
.
apply_time
.
values
())
if
local_time
>
0
:
if
local_time
>
0
:
self
.
summary_class
(
file
,
n_ops_to_print
)
self
.
summary_class
(
file
,
n_ops_to_print
)
...
...
theano/gradient.py
浏览文件 @
08e5dab2
...
@@ -10,6 +10,7 @@ __docformat__ = "restructuredtext en"
...
@@ -10,6 +10,7 @@ __docformat__ = "restructuredtext en"
import
__builtin__
import
__builtin__
from
itertools
import
izip
from
itertools
import
izip
import
logging
import
logging
import
time
import
warnings
import
warnings
_logger
=
logging
.
getLogger
(
'theano.gradient'
)
_logger
=
logging
.
getLogger
(
'theano.gradient'
)
...
@@ -36,6 +37,8 @@ tensor = None
...
@@ -36,6 +37,8 @@ tensor = None
_msg_retType
=
'op.grad(...) returned a non-list'
_msg_retType
=
'op.grad(...) returned a non-list'
grad_time
=
0
def
format_as
(
use_list
,
use_tuple
,
outputs
):
def
format_as
(
use_list
,
use_tuple
,
outputs
):
"""
"""
...
@@ -412,6 +415,7 @@ def grad(cost, wrt, consider_constant=None,
...
@@ -412,6 +415,7 @@ def grad(cost, wrt, consider_constant=None,
or Variable in all cases.
or Variable in all cases.
"""
"""
t0
=
time
.
time
()
global
tensor
global
tensor
if
tensor
is
None
:
if
tensor
is
None
:
from
theano
import
tensor
from
theano
import
tensor
...
@@ -556,8 +560,12 @@ def grad(cost, wrt, consider_constant=None,
...
@@ -556,8 +560,12 @@ def grad(cost, wrt, consider_constant=None,
rval
=
tuple
(
rval
)
rval
=
tuple
(
rval
)
elif
not
using_list
:
elif
not
using_list
:
rval
,
=
rval
rval
,
=
rval
t1
=
time
.
time
()
global
grad_time
grad_time
=
t1
-
t0
return
rval
return
rval
def
subgraph_grad
(
wrt
,
end
,
start
=
None
,
cost
=
None
,
details
=
False
):
def
subgraph_grad
(
wrt
,
end
,
start
=
None
,
cost
=
None
,
details
=
False
):
'''
'''
With respect to `wrt`, computes gradients of cost and/or from
With respect to `wrt`, computes gradients of cost and/or from
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论