Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
86d6b7d2
提交
86d6b7d2
authored
2月 26, 2014
作者:
Frederic
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Make the fusion optimizer profile more information.
上级
980e91d9
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
25 行增加
和
2 行删除
+25
-2
opt.py
theano/tensor/opt.py
+25
-2
没有找到文件。
theano/tensor/opt.py
浏览文件 @
86d6b7d2
...
@@ -7,11 +7,12 @@ Tensor optimizations addressing the ops in basic.py
...
@@ -7,11 +7,12 @@ Tensor optimizations addressing the ops in basic.py
import
logging
import
logging
_logger
=
logging
.
getLogger
(
'theano.tensor.opt'
)
_logger
=
logging
.
getLogger
(
'theano.tensor.opt'
)
import
operator
import
itertools
import
itertools
from
itertools
import
izip
import
operator
import
sys
import
sys
import
time
import
traceback
import
traceback
from
itertools
import
izip
import
numpy
import
numpy
import
numpy
as
N
# guys... please don't do this in the library :(
import
numpy
as
N
# guys... please don't do this in the library :(
...
@@ -4779,8 +4780,14 @@ class FusionOptimizer(Optimizer):
...
@@ -4779,8 +4780,14 @@ class FusionOptimizer(Optimizer):
def
apply
(
self
,
fgraph
):
def
apply
(
self
,
fgraph
):
did_something
=
True
did_something
=
True
nb_iter
=
0
nb_replacement
=
0
nb_inconsistency_replace
=
0
time_toposort
=
0
while
did_something
:
while
did_something
:
t0
=
time
.
time
()
nodelist
=
list
(
fgraph
.
toposort
())
nodelist
=
list
(
fgraph
.
toposort
())
time_toposort
+=
time
.
time
()
-
t0
nodelist
.
reverse
()
nodelist
.
reverse
()
did_something
=
False
did_something
=
False
for
node
in
nodelist
:
for
node
in
nodelist
:
...
@@ -4794,8 +4801,24 @@ class FusionOptimizer(Optimizer):
...
@@ -4794,8 +4801,24 @@ class FusionOptimizer(Optimizer):
zip
(
node
.
outputs
,
new_outputs
),
zip
(
node
.
outputs
,
new_outputs
),
reason
=
self
.
__class__
.
__name__
)
reason
=
self
.
__class__
.
__name__
)
did_something
=
True
did_something
=
True
nb_replacement
+=
1
except
InconsistencyError
:
except
InconsistencyError
:
nb_inconsistency_replace
+=
1
pass
pass
nb_iter
+=
1
return
(
self
,
nb_iter
,
nb_replacement
,
nb_inconsistency_replace
,
time_toposort
)
@staticmethod
def
print_profile
(
stream
,
prof
,
level
=
0
):
blanc
=
(
' '
*
level
)
print
>>
stream
,
blanc
,
"FusionOptimizer"
print
>>
stream
,
blanc
,
" nb_iter"
,
prof
[
1
]
print
>>
stream
,
blanc
,
" nb_replacement"
,
prof
[
2
]
print
>>
stream
,
blanc
,
" nb_inconsistency_replace"
,
prof
[
3
]
print
>>
stream
,
blanc
,
" time_toposort"
,
prof
[
4
]
if
config
.
tensor
.
local_elemwise_fusion
:
if
config
.
tensor
.
local_elemwise_fusion
:
_logger
.
debug
(
"enabling optimization fusion elemwise in fast_run"
)
_logger
.
debug
(
"enabling optimization fusion elemwise in fast_run"
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论