Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
6405a561
提交
6405a561
authored
12月 06, 2013
作者:
Pascal Lamblin
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1643 from nouiz/tests
Make a tests more robust to different seed
上级
8d790f5c
dfc7b0c8
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
41 行增加
和
8 行删除
+41
-8
opt.py
theano/sandbox/cuda/opt.py
+28
-8
test_conv_cuda_ndarray.py
theano/sandbox/cuda/tests/test_conv_cuda_ndarray.py
+13
-0
没有找到文件。
theano/sandbox/cuda/opt.py
浏览文件 @
6405a561
...
@@ -1050,6 +1050,21 @@ def local_gpu_conv(node):
...
@@ -1050,6 +1050,21 @@ def local_gpu_conv(node):
return
make_graph
return
make_graph
return
ret
return
ret
def
values_eq_approx
(
a
,
b
):
"""This fct is needed to don't have DebugMode raise useless
error due to ronding error.
This happen as We reduce on the two last dimensions, so this
can raise the absolute error if the number of element we
reduce on is significant.
"""
assert
a
.
ndim
==
4
atol
=
None
if
a
.
shape
[
-
1
]
*
a
.
shape
[
-
2
]
>
100
:
atol
=
3e-5
return
tensor
.
TensorType
.
values_eq_approx
(
a
,
b
,
atol
=
atol
)
if
node
.
op
==
gpu_from_host
:
if
node
.
op
==
gpu_from_host
:
#gpu_from_host(conv) -> gpu_conv(gpu_from_host)
#gpu_from_host(conv) -> gpu_conv(gpu_from_host)
host_input
=
node
.
inputs
[
0
]
host_input
=
node
.
inputs
[
0
]
...
@@ -1058,12 +1073,14 @@ def local_gpu_conv(node):
...
@@ -1058,12 +1073,14 @@ def local_gpu_conv(node):
if
gpu_conv
is
None
:
if
gpu_conv
is
None
:
return
return
img
,
kern
=
host_input
.
owner
.
inputs
img
,
kern
=
host_input
.
owner
.
inputs
out
=
gpu_conv
(
gpu_from_host
(
img
),
gpu_from_host
(
kern
))
out
=
tensor
.
patternbroadcast
(
out
,
node
.
outputs
[
0
]
.
broadcastable
)
out
.
values_eq_approx
=
values_eq_approx
# in some case the ConvOp broadcast the last 2 dimensions
# in some case the ConvOp broadcast the last 2 dimensions
# differently then the gpu ConvOp
# differently then the gpu ConvOp
return
[
tensor
.
patternbroadcast
(
return
[
out
]
gpu_conv
(
gpu_from_host
(
img
),
gpu_from_host
(
kern
)),
node
.
outputs
[
0
]
.
broadcastable
)]
if
isinstance
(
node
.
op
,
conv
.
ConvOp
):
if
isinstance
(
node
.
op
,
conv
.
ConvOp
):
#conv(host_from_gpu) -> host_from_gpu(gpu_conv)
#conv(host_from_gpu) -> host_from_gpu(gpu_conv)
...
@@ -1074,12 +1091,15 @@ def local_gpu_conv(node):
...
@@ -1074,12 +1091,15 @@ def local_gpu_conv(node):
gpu_conv
=
GpuConvOp_from_ConvOp
(
node
.
op
)
gpu_conv
=
GpuConvOp_from_ConvOp
(
node
.
op
)
if
gpu_conv
is
None
:
if
gpu_conv
is
None
:
return
return
out
=
gpu_conv
(
gpu_from_host
(
img
),
gpu_from_host
(
kern
))
out
=
tensor
.
patternbroadcast
(
host_from_gpu
(
out
),
node
.
outputs
[
0
]
.
broadcastable
)
out
.
values_eq_approx
=
values_eq_approx
# in some case the ConvOp broadcast the last 2 dimensions
# in some case the ConvOp broadcast the last 2 dimensions
# differently then the gpu ConvOp
# differently then the gpu ConvOp
return
[
tensor
.
patternbroadcast
(
return
[
out
]
host_from_gpu
(
gpu_conv
(
gpu_from_host
(
img
),
gpu_from_host
(
kern
))),
node
.
outputs
[
0
]
.
broadcastable
)]
import
theano.tensor.signal.downsample
as
downsample
import
theano.tensor.signal.downsample
as
downsample
...
...
theano/sandbox/cuda/tests/test_conv_cuda_ndarray.py
浏览文件 @
6405a561
...
@@ -19,6 +19,7 @@ except ImportError:
...
@@ -19,6 +19,7 @@ except ImportError:
import
theano
import
theano
from
theano
import
tensor
from
theano
import
tensor
from
theano.gof.python25
import
any
from
theano.gof.python25
import
any
from
theano.tests.unittest_tools
import
seed_rng
# Skip test if cuda_ndarray is not available.
# Skip test if cuda_ndarray is not available.
import
theano.sandbox.cuda
as
cuda_ndarray
import
theano.sandbox.cuda
as
cuda_ndarray
...
@@ -415,6 +416,7 @@ def get_valid_shapes():
...
@@ -415,6 +416,7 @@ def get_valid_shapes():
def
test_valid_0_2
():
def
test_valid_0_2
():
seed_rng
()
shapes
=
get_valid_shapes
()
shapes
=
get_valid_shapes
()
version
=
[
0
,
2
]
version
=
[
0
,
2
]
verbose
=
0
verbose
=
0
...
@@ -446,6 +448,7 @@ def test_valid_0_2():
...
@@ -446,6 +448,7 @@ def test_valid_0_2():
def
test_valid_1_3_11_12
():
def
test_valid_1_3_11_12
():
seed_rng
()
shapes
=
get_valid_shapes
()
shapes
=
get_valid_shapes
()
version
=
[
1
,
3
,
11
,
12
]
version
=
[
1
,
3
,
11
,
12
]
verbose
=
0
verbose
=
0
...
@@ -475,6 +478,7 @@ def test_valid_1_3_11_12():
...
@@ -475,6 +478,7 @@ def test_valid_1_3_11_12():
def
test_valid_4
():
def
test_valid_4
():
seed_rng
()
shapes
=
get_valid_shapes
()
shapes
=
get_valid_shapes
()
version
=
[
4
]
version
=
[
4
]
verbose
=
0
verbose
=
0
...
@@ -506,6 +510,7 @@ def test_valid_4():
...
@@ -506,6 +510,7 @@ def test_valid_4():
def
test_valid_5
():
def
test_valid_5
():
seed_rng
()
shapes
=
get_valid_shapes
()
shapes
=
get_valid_shapes
()
version
=
[
5
]
version
=
[
5
]
verbose
=
0
verbose
=
0
...
@@ -537,6 +542,7 @@ def test_valid_5():
...
@@ -537,6 +542,7 @@ def test_valid_5():
def
test_valid_7_8_13
():
def
test_valid_7_8_13
():
seed_rng
()
shapes
=
get_valid_shapes
()
shapes
=
get_valid_shapes
()
# This is to test the "new" lower shared memory usage.
# This is to test the "new" lower shared memory usage.
shapes
.
append
(((
10
,
30
,
60
,
60
),
(
20
,
30
,
40
,
40
),
shapes
.
append
(((
10
,
30
,
60
,
60
),
(
20
,
30
,
40
,
40
),
...
@@ -571,6 +577,7 @@ def test_valid_7_8_13():
...
@@ -571,6 +577,7 @@ def test_valid_7_8_13():
def
test_valid_9_10
():
def
test_valid_9_10
():
seed_rng
()
shapes
=
get_valid_shapes
()
shapes
=
get_valid_shapes
()
version
=
[
9
,
10
]
version
=
[
9
,
10
]
verbose
=
0
verbose
=
0
...
@@ -601,6 +608,7 @@ def test_valid_9_10():
...
@@ -601,6 +608,7 @@ def test_valid_9_10():
def
test_valid
():
def
test_valid
():
seed_rng
()
shapes
=
get_valid_shapes
()
shapes
=
get_valid_shapes
()
#shapes=shapes[400:426]
#shapes=shapes[400:426]
...
@@ -621,6 +629,7 @@ def test_valid():
...
@@ -621,6 +629,7 @@ def test_valid():
def
test_full
():
def
test_full
():
seed_rng
()
shapes
=
get_basic_shapes
()
shapes
=
get_basic_shapes
()
shapes
+=
get_shapes2
()
shapes
+=
get_shapes2
()
#test image stride
#test image stride
...
@@ -682,6 +691,7 @@ def test_full():
...
@@ -682,6 +691,7 @@ def test_full():
def
test_subsample
():
def
test_subsample
():
seed_rng
()
# implement when
# implement when
shapes
=
[((
1
,
1
,
1
,
1
),
(
1
,
1
,
1
,
1
),
(
1
,
1
),
(
1
,
1
),
(
1
,
1
)),
shapes
=
[((
1
,
1
,
1
,
1
),
(
1
,
1
,
1
,
1
),
(
1
,
1
),
(
1
,
1
),
(
1
,
1
)),
((
1
,
1
,
1
,
1
),
(
1
,
1
,
1
,
1
),
(
2
,
2
),
(
1
,
1
),
(
1
,
1
)),
((
1
,
1
,
1
,
1
),
(
1
,
1
,
1
,
1
),
(
2
,
2
),
(
1
,
1
),
(
1
,
1
)),
...
@@ -712,6 +722,7 @@ def test_subsample():
...
@@ -712,6 +722,7 @@ def test_subsample():
class
TestConv2DGPU
(
unittest
.
TestCase
):
class
TestConv2DGPU
(
unittest
.
TestCase
):
def
test_logical_shapes
(
self
):
def
test_logical_shapes
(
self
):
seed_rng
()
for
stride
in
range
(
1
,
4
):
for
stride
in
range
(
1
,
4
):
kshp
=
(
10
,
2
,
10
,
10
)
kshp
=
(
10
,
2
,
10
,
10
)
featshp
=
(
3
,
10
,
11
,
11
)
featshp
=
(
3
,
10
,
11
,
11
)
...
@@ -749,6 +760,7 @@ class TestConv2DGPU(unittest.TestCase):
...
@@ -749,6 +760,7 @@ class TestConv2DGPU(unittest.TestCase):
Tests that when the shape gived at build time is not the same as
Tests that when the shape gived at build time is not the same as
run time we raise an error
run time we raise an error
"""
"""
seed_rng
()
verbose
=
0
verbose
=
0
random
=
True
random
=
True
print_
=
False
print_
=
False
...
@@ -860,6 +872,7 @@ def benchmark():
...
@@ -860,6 +872,7 @@ def benchmark():
def
test_stack_rows_segfault_070312
():
def
test_stack_rows_segfault_070312
():
seed_rng
()
# 07/03/2012
# 07/03/2012
# Running this unittest with cuda-memcheck exposes an illegal read.
# Running this unittest with cuda-memcheck exposes an illegal read.
# THEANO_FLAGS=device=gpu cuda-memcheck nosetests \
# THEANO_FLAGS=device=gpu cuda-memcheck nosetests \
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论