Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
0cbfeae8
提交
0cbfeae8
authored
6月 27, 2017
作者:
notoraptor
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add 3D tests and add a fix
(replace algo `small` by `none` if necessary).
上级
2d41daaf
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
27 行增加
和
11 行删除
+27
-11
dnn_fwd.c
theano/gpuarray/dnn_fwd.c
+8
-3
test_dnn.py
theano/gpuarray/tests/test_dnn.py
+19
-8
没有找到文件。
theano/gpuarray/dnn_fwd.c
浏览文件 @
0cbfeae8
...
@@ -163,10 +163,15 @@ APPLY_SPECIFIC(conv_fwd)(PyGpuArrayObject *input, PyGpuArrayObject *kerns,
...
@@ -163,10 +163,15 @@ APPLY_SPECIFIC(conv_fwd)(PyGpuArrayObject *input, PyGpuArrayObject *kerns,
}
}
}
}
/*
These two algos are not supported for 3d conv
*/
/*
Only these algos are supported for 3d conv with cuDNN >= V5.1.
*/
if
(
PyGpuArray_NDIM
(
input
)
==
5
&&
if
(
PyGpuArray_NDIM
(
input
)
==
5
&&
(
algo
==
CUDNN_CONVOLUTION_FWD_ALGO_IMPLICIT_PRECOMP_GEMM
||
!
(
algo
==
CUDNN_CONVOLUTION_FWD_ALGO_IMPLICIT_GEMM
||
algo
==
CUDNN_CONVOLUTION_FWD_ALGO_GEMM
))
algo
==
CUDNN_CONVOLUTION_FWD_ALGO_IMPLICIT_PRECOMP_GEMM
||
algo
==
CUDNN_CONVOLUTION_FWD_ALGO_FFT_TILING
))
algo
=
CUDNN_CONVOLUTION_FWD_ALGO_IMPLICIT_GEMM
;
/* Algo `small` seems to not work for a batch size > 2^16, with cuDNN >= V5.1. */
if
(
algo
==
CUDNN_CONVOLUTION_FWD_ALGO_IMPLICIT_PRECOMP_GEMM
&&
PyGpuArray_DIM
(
input
,
0
)
>
65536
)
algo
=
CUDNN_CONVOLUTION_FWD_ALGO_IMPLICIT_GEMM
;
algo
=
CUDNN_CONVOLUTION_FWD_ALGO_IMPLICIT_GEMM
;
// The FFT implementation does not support strides, 1x1 filters or inputs
// The FFT implementation does not support strides, 1x1 filters or inputs
...
...
theano/gpuarray/tests/test_dnn.py
浏览文件 @
0cbfeae8
...
@@ -1068,7 +1068,7 @@ def get_conv3d_test_cases():
...
@@ -1068,7 +1068,7 @@ def get_conv3d_test_cases():
def
run_conv_small_batched_vs_multicall
(
inputs_shape
,
filters_shape
,
batch_sub
,
subsample
):
def
run_conv_small_batched_vs_multicall
(
inputs_shape
,
filters_shape
,
batch_sub
,
subsample
):
#
Run function for issue $
5985 (see tests below): https://github.com/Theano/Theano/issues/5985
#
Function to check issue #
5985 (see tests below): https://github.com/Theano/Theano/issues/5985
algo
=
'small'
algo
=
'small'
batch_size
=
inputs_shape
[
0
]
batch_size
=
inputs_shape
[
0
]
...
@@ -1081,16 +1081,20 @@ def run_conv_small_batched_vs_multicall(inputs_shape, filters_shape, batch_sub,
...
@@ -1081,16 +1081,20 @@ def run_conv_small_batched_vs_multicall(inputs_shape, filters_shape, batch_sub,
inputs
=
theano
.
shared
(
inputs_val
)
inputs
=
theano
.
shared
(
inputs_val
)
filters
=
theano
.
shared
(
filters_val
)
filters
=
theano
.
shared
(
filters_val
)
conv
=
dnn
.
dnn_conv
(
img
=
inputs
,
kerns
=
filters
,
algo
=
algo
,
subsample
=
subsample
)
if
len
(
inputs_shape
)
==
5
:
dnn_func
=
dnn
.
dnn_conv3d
else
:
dnn_func
=
dnn
.
dnn_conv
conv
=
dnn_func
(
img
=
inputs
,
kerns
=
filters
,
algo
=
algo
,
subsample
=
subsample
)
# Just compute firt and last outputs to reduce execution time.
# Just compute firt and last outputs to reduce execution time.
sub_conv_top
=
dnn
.
dnn_conv
(
img
=
inputs
[:
batch_sub
],
sub_conv_top
=
dnn
_func
(
img
=
inputs
[:
batch_sub
],
kerns
=
filters
,
algo
=
algo
,
subsample
=
subsample
)
kerns
=
filters
,
algo
=
algo
,
subsample
=
subsample
)
sub_conv_bottom
=
dnn
.
dnn_conv
(
img
=
inputs
[(
batch_size
-
batch_sub
):],
sub_conv_bottom
=
dnn
_func
(
img
=
inputs
[(
batch_size
-
batch_sub
):],
kerns
=
filters
,
algo
=
algo
,
subsample
=
subsample
)
kerns
=
filters
,
algo
=
algo
,
subsample
=
subsample
)
f
=
theano
.
function
([],
[
conv
,
sub_conv_top
,
sub_conv_bottom
],
mode
=
mode_with_gpu
)
f
=
theano
.
function
([],
[
conv
,
sub_conv_top
,
sub_conv_bottom
],
mode
=
mode_with_gpu
)
res_all
,
res_batch_top
,
res_batch_bottom
=
f
()
res_all
,
res_batch_top
,
res_batch_bottom
=
f
()
for
i
in
range
(
0
,
batch_sub
):
for
i
in
range
(
0
,
batch_sub
):
utt
.
assert_allclose
(
res_
all
[
i
],
res_batch_top
[
i
])
utt
.
assert_allclose
(
res_
batch_top
[
i
],
res_all
[
i
])
p
=
batch_size
-
batch_sub
+
i
p
=
batch_size
-
batch_sub
+
i
# It seems there is a liimit batch size of 65536 for a good computation
# It seems there is a liimit batch size of 65536 for a good computation
# with algorithm `small`.
# with algorithm `small`.
...
@@ -1100,7 +1104,7 @@ def run_conv_small_batched_vs_multicall(inputs_shape, filters_shape, batch_sub,
...
@@ -1100,7 +1104,7 @@ def run_conv_small_batched_vs_multicall(inputs_shape, filters_shape, batch_sub,
# It should not happen.
# It should not happen.
if
np
.
allclose
(
res_all
[
p
%
checked_limit
],
res_all
[
p
]):
if
np
.
allclose
(
res_all
[
p
%
checked_limit
],
res_all
[
p
]):
print
(
'
\n
conv[
%
d] == conv[
%
d] ==
%
s'
%
(
p
%
checked_limit
,
p
,
res_all
[
p
]))
print
(
'
\n
conv[
%
d] == conv[
%
d] ==
%
s'
%
(
p
%
checked_limit
,
p
,
res_all
[
p
]))
utt
.
assert_allclose
(
res_
all
[
p
],
res_batch_bottom
[
i
])
utt
.
assert_allclose
(
res_
batch_bottom
[
i
],
res_all
[
p
])
def
test_batched_conv_small
():
def
test_batched_conv_small
():
...
@@ -1110,6 +1114,13 @@ def test_batched_conv_small():
...
@@ -1110,6 +1114,13 @@ def test_batched_conv_small():
yield
(
run_conv_small_batched_vs_multicall
,
(
65537
,
2
,
2
,
2
),
(
1
,
2
,
2
,
2
),
5
,
(
1
,
1
))
# ERROR
yield
(
run_conv_small_batched_vs_multicall
,
(
65537
,
2
,
2
,
2
),
(
1
,
2
,
2
,
2
),
5
,
(
1
,
1
))
# ERROR
def
test_batched_conv3d_small
():
yield
(
run_conv_small_batched_vs_multicall
,
(
65534
,
2
,
2
,
2
,
2
),
(
1
,
2
,
2
,
2
,
2
),
5
,
(
1
,
1
,
1
))
# OK
yield
(
run_conv_small_batched_vs_multicall
,
(
65535
,
2
,
2
,
2
,
2
),
(
1
,
2
,
2
,
2
,
2
),
5
,
(
1
,
1
,
1
))
# OK
yield
(
run_conv_small_batched_vs_multicall
,
(
65536
,
2
,
2
,
2
,
2
),
(
1
,
2
,
2
,
2
,
2
),
5
,
(
1
,
1
,
1
))
# OK
yield
(
run_conv_small_batched_vs_multicall
,
(
65537
,
2
,
2
,
2
,
2
),
(
1
,
2
,
2
,
2
,
2
),
5
,
(
1
,
1
,
1
))
# ERROR ALSO.
def
test_conv3d_fwd
():
def
test_conv3d_fwd
():
if
not
dnn
.
dnn_available
(
test_ctx_name
):
if
not
dnn
.
dnn_available
(
test_ctx_name
):
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论