Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
b725ce72
提交
b725ce72
authored
1月 29, 2014
作者:
Arnaud Bergeron
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix huge amount of whitespace in between function arguments in tests.
上级
10efa2bf
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
17 行增加
和
19 行删除
+17
-19
profiling.py
theano/compile/profiling.py
+3
-3
test_opt.py
theano/tensor/tests/test_opt.py
+14
-16
没有找到文件。
theano/compile/profiling.py
浏览文件 @
b725ce72
...
@@ -882,9 +882,9 @@ if 0: # old code still to be ported from ProfileMode
...
@@ -882,9 +882,9 @@ if 0: # old code still to be ported from ProfileMode
print
'Theano fct call
%.3
fs
%.1
f
%%
'
%
(
total_fct_time
,
print
'Theano fct call
%.3
fs
%.1
f
%%
'
%
(
total_fct_time
,
total_fct_time
/
total_time
*
total_fct_time
/
total_time
*
100
)
100
)
print
' Theano Op time (included in fct call, Time spent
running thunks)
%.3
fs
%.1
f
%%
(of total)
%.1
f
%%
(of fct call)'
%
(
local_time
,
print
' Theano Op time (included in fct call, Time spent
'
\
local_time
/
total_time
*
100
,
'running thunks)
%.3
fs
%.1
f
%%
(of total)
%.1
f
%%
(of fct call)'
%
\
time_pr_in_fct
)
(
local_time
,
local_time
/
total_time
*
100
,
time_pr_in_fct
)
print
'Other time since import
%.3
fs
%.1
f
%%
'
%
(
other_time
,
other_time
/
total_time
*
100
)
print
'Other time since import
%.3
fs
%.1
f
%%
'
%
(
other_time
,
other_time
/
total_time
*
100
)
print
'
%
i Theano fct call,
%.3
fs per call'
%
(
total_fct_call
,
time_per_call
)
print
'
%
i Theano fct call,
%.3
fs per call'
%
(
total_fct_call
,
time_per_call
)
...
...
theano/tensor/tests/test_opt.py
浏览文件 @
b725ce72
...
@@ -326,13 +326,11 @@ class test_canonize(unittest.TestCase):
...
@@ -326,13 +326,11 @@ class test_canonize(unittest.TestCase):
fxv
=
theano
.
_asarray
(
numpy
.
random
.
rand
(
*
shp
),
dtype
=
'float32'
)
fxv
=
theano
.
_asarray
(
numpy
.
random
.
rand
(
*
shp
),
dtype
=
'float32'
)
fyv
=
theano
.
_asarray
(
numpy
.
random
.
rand
(
*
shp
),
dtype
=
'float32'
)
fyv
=
theano
.
_asarray
(
numpy
.
random
.
rand
(
*
shp
),
dtype
=
'float32'
)
fzv
=
theano
.
_asarray
(
numpy
.
random
.
rand
(
*
shp
),
dtype
=
'float32'
)
fzv
=
theano
.
_asarray
(
numpy
.
random
.
rand
(
*
shp
),
dtype
=
'float32'
)
fvv
=
theano
.
_asarray
(
numpy
.
random
.
rand
(
shp
[
0
]),
dtype
=
fvv
=
theano
.
_asarray
(
numpy
.
random
.
rand
(
shp
[
0
]),
dtype
=
'float32'
)
.
reshape
(
1
,
shp
[
0
])
'float32'
)
.
reshape
(
1
,
shp
[
0
])
dxv
=
theano
.
_asarray
(
numpy
.
random
.
rand
(
*
shp
),
dtype
=
'float64'
)
dxv
=
theano
.
_asarray
(
numpy
.
random
.
rand
(
*
shp
),
dtype
=
'float64'
)
dyv
=
theano
.
_asarray
(
numpy
.
random
.
rand
(
*
shp
),
dtype
=
'float64'
)
dyv
=
theano
.
_asarray
(
numpy
.
random
.
rand
(
*
shp
),
dtype
=
'float64'
)
dzv
=
theano
.
_asarray
(
numpy
.
random
.
rand
(
*
shp
),
dtype
=
'float64'
)
dzv
=
theano
.
_asarray
(
numpy
.
random
.
rand
(
*
shp
),
dtype
=
'float64'
)
dvv
=
theano
.
_asarray
(
numpy
.
random
.
rand
(
shp
[
0
]),
dtype
=
dvv
=
theano
.
_asarray
(
numpy
.
random
.
rand
(
shp
[
0
]),
dtype
=
'float64'
)
.
reshape
(
1
,
shp
[
0
])
'float64'
)
.
reshape
(
1
,
shp
[
0
])
cases
=
[
cases
=
[
(
fx
+
fy
,
(
fx
,
fy
),
(
fxv
,
fyv
),
1
,
'float32'
),
(
fx
+
fy
,
(
fx
,
fy
),
(
fxv
,
fyv
),
1
,
'float32'
),
(
fx
*
fy
,
(
fx
,
fy
),
(
fxv
,
fyv
),
1
,
'float32'
),
(
fx
*
fy
,
(
fx
,
fy
),
(
fxv
,
fyv
),
1
,
'float32'
),
...
@@ -433,14 +431,12 @@ class test_canonize(unittest.TestCase):
...
@@ -433,14 +431,12 @@ class test_canonize(unittest.TestCase):
fyv
=
theano
.
_asarray
(
numpy
.
random
.
rand
(
*
shp
),
dtype
=
'float32'
)
fyv
=
theano
.
_asarray
(
numpy
.
random
.
rand
(
*
shp
),
dtype
=
'float32'
)
fzv
=
theano
.
_asarray
(
numpy
.
random
.
rand
(
*
shp
),
dtype
=
'float32'
)
fzv
=
theano
.
_asarray
(
numpy
.
random
.
rand
(
*
shp
),
dtype
=
'float32'
)
fwv
=
theano
.
_asarray
(
numpy
.
random
.
rand
(
*
shp
),
dtype
=
'float32'
)
fwv
=
theano
.
_asarray
(
numpy
.
random
.
rand
(
*
shp
),
dtype
=
'float32'
)
fvv
=
theano
.
_asarray
(
numpy
.
random
.
rand
(
shp
[
0
]),
dtype
=
fvv
=
theano
.
_asarray
(
numpy
.
random
.
rand
(
shp
[
0
]),
dtype
=
'float32'
)
.
reshape
(
1
,
shp
[
0
])
'float32'
)
.
reshape
(
1
,
shp
[
0
])
dxv
=
theano
.
_asarray
(
numpy
.
random
.
rand
(
*
shp
),
dtype
=
'float64'
)
dxv
=
theano
.
_asarray
(
numpy
.
random
.
rand
(
*
shp
),
dtype
=
'float64'
)
dyv
=
theano
.
_asarray
(
numpy
.
random
.
rand
(
*
shp
),
dtype
=
'float64'
)
dyv
=
theano
.
_asarray
(
numpy
.
random
.
rand
(
*
shp
),
dtype
=
'float64'
)
dzv
=
theano
.
_asarray
(
numpy
.
random
.
rand
(
*
shp
),
dtype
=
'float64'
)
dzv
=
theano
.
_asarray
(
numpy
.
random
.
rand
(
*
shp
),
dtype
=
'float64'
)
dwv
=
theano
.
_asarray
(
numpy
.
random
.
rand
(
*
shp
),
dtype
=
'float64'
)
dwv
=
theano
.
_asarray
(
numpy
.
random
.
rand
(
*
shp
),
dtype
=
'float64'
)
dvv
=
theano
.
_asarray
(
numpy
.
random
.
rand
(
shp
[
0
]),
dtype
=
dvv
=
theano
.
_asarray
(
numpy
.
random
.
rand
(
shp
[
0
]),
dtype
=
'float64'
)
.
reshape
(
1
,
shp
[
0
])
'float64'
)
.
reshape
(
1
,
shp
[
0
])
#We must be sure that the Canonizer is working, but that we don't have other
#We must be sure that the Canonizer is working, but that we don't have other
# optimisation that could hide bug in the Canonizer as local_elemwise_fusion
# optimisation that could hide bug in the Canonizer as local_elemwise_fusion
...
@@ -695,8 +691,7 @@ class test_canonize(unittest.TestCase):
...
@@ -695,8 +691,7 @@ class test_canonize(unittest.TestCase):
dxv
=
theano
.
_asarray
(
numpy
.
random
.
rand
(
*
shp
),
dtype
=
'float32'
)
dxv
=
theano
.
_asarray
(
numpy
.
random
.
rand
(
*
shp
),
dtype
=
'float32'
)
dyv
=
theano
.
_asarray
(
numpy
.
random
.
rand
(
*
shp
),
dtype
=
'float32'
)
dyv
=
theano
.
_asarray
(
numpy
.
random
.
rand
(
*
shp
),
dtype
=
'float32'
)
dzv
=
theano
.
_asarray
(
numpy
.
random
.
rand
(
*
shp
),
dtype
=
'float32'
)
dzv
=
theano
.
_asarray
(
numpy
.
random
.
rand
(
*
shp
),
dtype
=
'float32'
)
fvv
=
theano
.
_asarray
(
numpy
.
random
.
rand
(
shp
[
0
]),
dtype
=
fvv
=
theano
.
_asarray
(
numpy
.
random
.
rand
(
shp
[
0
]),
dtype
=
'float32'
)
.
reshape
(
1
,
shp
[
0
])
'float32'
)
.
reshape
(
1
,
shp
[
0
])
#We must be sure that the Canonizer is working, but that we don't have other
#We must be sure that the Canonizer is working, but that we don't have other
# optimisation that could hide bug in the Canonizer as local_elemwise_fusion
# optimisation that could hide bug in the Canonizer as local_elemwise_fusion
mode
=
compile
.
mode
.
get_default_mode
()
mode
=
compile
.
mode
.
get_default_mode
()
...
@@ -1217,8 +1212,10 @@ class test_fusion(unittest.TestCase):
...
@@ -1217,8 +1212,10 @@ class test_fusion(unittest.TestCase):
mode2
=
copy
.
copy
(
compile
.
get_default_mode
())
mode2
=
copy
.
copy
(
compile
.
get_default_mode
())
mode2
.
_optimizer
=
mode2
.
_optimizer
.
excluding
(
'local_elemwise_fusion'
)
mode2
.
_optimizer
=
mode2
.
_optimizer
.
excluding
(
'local_elemwise_fusion'
)
print
"test with linker"
,
str
(
mode1
.
linker
)
print
"test with linker"
,
str
(
mode1
.
linker
)
times1
=
self
.
do
(
mode1
,
shared_fn
,
shp
,
gpu
=
gpu
,
nb_repeat
=
nb_repeat
,
assert_len_topo
=
False
,
slice
=
s
)
times1
=
self
.
do
(
mode1
,
shared_fn
,
shp
,
gpu
=
gpu
,
nb_repeat
=
nb_repeat
,
times2
=
self
.
do
(
mode2
,
shared_fn
,
shp
,
gpu
=
gpu
,
nb_repeat
=
nb_repeat
,
assert_len_topo
=
False
,
slice
=
s
)
assert_len_topo
=
False
,
slice
=
s
)
times2
=
self
.
do
(
mode2
,
shared_fn
,
shp
,
gpu
=
gpu
,
nb_repeat
=
nb_repeat
,
assert_len_topo
=
False
,
slice
=
s
)
print
"times1 with local_elemwise_fusion"
print
"times1 with local_elemwise_fusion"
print
times1
,
times1
.
min
(),
times1
.
max
(),
times1
.
sum
()
print
times1
,
times1
.
min
(),
times1
.
max
(),
times1
.
sum
()
print
"times2 without local_elemwise_fusion"
print
"times2 without local_elemwise_fusion"
...
@@ -1256,11 +1253,12 @@ class test_fusion(unittest.TestCase):
...
@@ -1256,11 +1253,12 @@ class test_fusion(unittest.TestCase):
linker
=
gof
.
OpWiseCLinker
linker
=
gof
.
OpWiseCLinker
mode
=
compile
.
Mode
(
linker
(),
copy
.
copy
(
compile
.
mode
.
OPT_FAST_RUN
))
mode
=
compile
.
Mode
(
linker
(),
copy
.
copy
(
compile
.
mode
.
OPT_FAST_RUN
))
mode
=
compile
.
ProfileMode
()
mode
=
compile
.
ProfileMode
()
print
"time"
,
self
.
do
(
mode
,
shared
,
shp
=
(
1000
,
1000
),
gpu
=
print
"time"
,
self
.
do
(
mode
,
shared
,
shp
=
(
1000
,
1000
),
gpu
=
False
,
False
,
assert_len_topo
=
False
,
slice
=
s
,
nb_repeat
=
100
)
assert_len_topo
=
False
,
slice
=
s
,
nb_repeat
=
100
)
def
tes_memory_leak
(
self
,
mode
=
compile
.
mode
.
Mode
(
'c'
,
'merge'
),
shared_fn
=
shared
,
shp
=
(
3000
,
3000
),
gpu
=
False
,
nb_repeat
=
30
,
assert_len_topo
=
True
,
slice
=
None
):
def
tes_memory_leak
(
self
,
mode
=
compile
.
mode
.
Mode
(
'c'
,
'merge'
),
shared_fn
=
shared
,
shp
=
(
3000
,
3000
),
gpu
=
False
,
nb_repeat
=
30
,
assert_len_topo
=
True
,
slice
=
None
):
"""
"""
param shared_fn: if None, will use compile.function
param shared_fn: if None, will use compile.function
verify that the elemwise fusion work
verify that the elemwise fusion work
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论