Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
b5e340ba
提交
b5e340ba
authored
8月 13, 2014
作者:
Arjun Jain
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #7 from f0k/cormm-cleantest
Cleanup CUDA convolution tests
上级
4d4c9280
68e82eca
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
41 行增加
和
34 行删除
+41
-34
test_conv_cuda_ndarray.py
theano/sandbox/cuda/tests/test_conv_cuda_ndarray.py
+41
-34
没有找到文件。
theano/sandbox/cuda/tests/test_conv_cuda_ndarray.py
浏览文件 @
b5e340ba
...
@@ -262,7 +262,6 @@ def exec_conv(version, shapes, verbose, random, mode,
...
@@ -262,7 +262,6 @@ def exec_conv(version, shapes, verbose, random, mode,
failed_version
=
set
()
failed_version
=
set
()
failed_id
=
[]
failed_id
=
[]
# I put -1 in case we forget to add version in the test to.
for
ver
in
version
:
for
ver
in
version
:
for
id
,
(
ishape
,
kshape
,
subshape
,
for
id
,
(
ishape
,
kshape
,
subshape
,
istride
,
kstride
)
in
enumerate
(
shapes
):
istride
,
kstride
)
in
enumerate
(
shapes
):
...
@@ -616,7 +615,7 @@ def test_valid_9_10():
...
@@ -616,7 +615,7 @@ def test_valid_9_10():
print_
=
print_
,
ones
=
ones
,
rtol
=
1.1e-5
)
print_
=
print_
,
ones
=
ones
,
rtol
=
1.1e-5
)
def
test_valid
():
def
test_valid
(
conv_gemm
=
False
):
seed_rng
()
seed_rng
()
shapes
=
get_valid_shapes
()
shapes
=
get_valid_shapes
()
...
@@ -625,7 +624,6 @@ def test_valid():
...
@@ -625,7 +624,6 @@ def test_valid():
# I put -2 to test the reference version.
# I put -2 to test the reference version.
version
=
[
-
2
,
-
1
,
6
]
version
=
[
-
2
,
-
1
,
6
]
verbose
=
0
verbose
=
0
# version=[1]
random
=
True
random
=
True
print_
=
False
print_
=
False
...
@@ -633,21 +631,25 @@ def test_valid():
...
@@ -633,21 +631,25 @@ def test_valid():
if
ones
:
if
ones
:
random
=
False
random
=
False
# exec_conv(version, shapes, verbose, random, 'valid',
if
conv_gemm
:
# print_=print_, ones=ones, rtol=1.1e-5)
# Test the GpuCorrMM version
mode
=
theano_mode
.
including
(
"conv_gemm"
)
mode
=
theano_mode
.
including
(
"conv_gemm"
)
cls
=
cuda
.
blas
.
GpuCorrMM
version
=
[
-
1
]
# dummy version; not used by GpuCorrMM so one version is enough
version
=
[
-
1
]
# Add tests with strided inputs by still square images and filters.
# Add tests with strided inputs by still square images and filters.
shapes
+=
get_shapes2
(
scales_img
=
(
2
,
2
),
img_stride
=
(
2
,
2
))
shapes
+=
get_shapes2
(
scales_img
=
(
2
,
2
),
img_stride
=
(
2
,
2
))
shapes
+=
get_shapes2
(
scales_kern
=
(
2
,
2
),
kern_stride
=
(
2
,
2
))
shapes
+=
get_shapes2
(
scales_kern
=
(
2
,
2
),
kern_stride
=
(
2
,
2
))
else
:
mode
=
cls
=
None
exec_conv
(
version
,
shapes
,
verbose
,
random
,
'valid'
,
exec_conv
(
version
,
shapes
,
verbose
,
random
,
'valid'
,
print_
=
print_
,
ones
=
ones
,
rtol
=
1.1e-5
,
print_
=
print_
,
ones
=
ones
,
rtol
=
1.1e-5
,
theano_mode
=
mode
,
cls
=
cuda
.
blas
.
GpuCorrMM
)
theano_mode
=
mode
,
cls
=
cls
)
def
test_gemm_valid
():
test_valid
(
conv_gemm
=
True
)
def
test_full
():
def
test_full
(
conv_gemm
=
False
):
seed_rng
()
seed_rng
()
shapes
=
get_basic_shapes
()
shapes
=
get_basic_shapes
()
shapes
+=
get_shapes2
()
shapes
+=
get_shapes2
()
...
@@ -704,22 +706,24 @@ def test_full():
...
@@ -704,22 +706,24 @@ def test_full():
# shapes=shapes[:277]
# shapes=shapes[:277]
version
=
[
-
2
,
-
1
,
0
,
1
,
2
,
3
,
4
,
5
]
version
=
[
-
2
,
-
1
,
0
,
1
,
2
,
3
,
4
,
5
]
verbose
=
0
verbose
=
0
# version=[4]
random
=
True
random
=
True
# exec_conv(version, shapes, verbose, random, 'full')
if
conv_gemm
:
# Test the GpuCorrMM version
# Test the GpuCorrMM version
mode
=
theano_mode
.
including
(
"conv_gemm"
)
mode
=
theano_mode
.
including
(
"conv_gemm"
)
cls
=
cuda
.
blas
.
GpuCorrMM
version
=
[
-
1
]
# dummy version; not used by GpuCorrMM so one version is enough
shapes
=
shapes
[
0
:
10
]
else
:
mode
=
cls
=
None
exec_conv
(
version
,
shapes
,
verbose
,
random
,
'full'
,
exec_conv
(
version
,
shapes
,
verbose
,
random
,
'full'
,
theano_mode
=
mode
,
cls
=
cuda
.
blas
.
GpuCorrMM
)
theano_mode
=
mode
,
cls
=
cls
)
def
test_gemm_full
():
test_full
(
conv_gemm
=
True
)
def
test_subsample
():
def
test_subsample
(
conv_gemm
=
False
):
seed_rng
()
seed_rng
()
# 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
)),
((
4
,
2
,
10
,
10
),
(
3
,
2
,
2
,
2
),
(
1
,
3
),
(
1
,
1
),
(
1
,
1
)),
((
4
,
2
,
10
,
10
),
(
3
,
2
,
2
,
2
),
(
1
,
3
),
(
1
,
1
),
(
1
,
1
)),
...
@@ -741,20 +745,23 @@ def test_subsample():
...
@@ -741,20 +745,23 @@ def test_subsample():
if
ones
:
if
ones
:
random
=
False
random
=
False
# exec_conv(version_valid, shapes, verbose, random, 'valid',
if
conv_gemm
:
# print_=print_, ones=ones)
# Test the GpuCorrMM version
# exec_conv(version_full, shapes, verbose, random, 'full',
mode
=
theano_mode
.
including
(
"conv_gemm"
)
# print_=print_, ones=ones)
cls
=
cuda
.
blas
.
GpuCorrMM
version_valid
=
version_full
=
[
-
1
]
# dummy version; not used by GpuCorrMM so one version is enough
# Test the GpuCorrMM version
else
:
mode
=
theano_mode
.
including
(
"conv_gemm"
)
mode
=
cls
=
None
exec_conv
(
version_valid
,
shapes
,
verbose
,
random
,
'valid'
,
exec_conv
(
version_valid
,
shapes
,
verbose
,
random
,
'valid'
,
print_
=
print_
,
ones
=
ones
,
print_
=
print_
,
ones
=
ones
,
theano_mode
=
mode
,
cls
=
c
uda
.
blas
.
GpuCorrMM
)
theano_mode
=
mode
,
cls
=
c
ls
)
exec_conv
(
version_full
,
shapes
,
verbose
,
random
,
'full'
,
exec_conv
(
version_full
,
shapes
,
verbose
,
random
,
'full'
,
print_
=
print_
,
ones
=
ones
,
print_
=
print_
,
ones
=
ones
,
theano_mode
=
mode
,
cls
=
cuda
.
blas
.
GpuCorrMM
)
theano_mode
=
mode
,
cls
=
cls
)
def
test_gemm_subsample
():
test_subsample
(
conv_gemm
=
True
)
class
TestConv2DGPU
(
unittest
.
TestCase
):
class
TestConv2DGPU
(
unittest
.
TestCase
):
...
@@ -829,7 +836,7 @@ class TestConv2DGPU(unittest.TestCase):
...
@@ -829,7 +836,7 @@ class TestConv2DGPU(unittest.TestCase):
def
test_gemm
():
def
test_gemm
_directly
():
"""
"""
input: (batch size, channels, rows, columns)
input: (batch size, channels, rows, columns)
filters: (number of filters, channels, rows, columns)
filters: (number of filters, channels, rows, columns)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论