Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
109b378c
提交
109b378c
authored
11月 29, 2016
作者:
Arnaud Bergeron
提交者:
Frederic Bastien
12月 22, 2016
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Require cudnn v5 minimum.
上级
c251a77d
显示空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
11 行增加
和
58 行删除
+11
-58
dnn.py
theano/gpuarray/dnn.py
+11
-39
dnn_base.c
theano/gpuarray/dnn_base.c
+0
-4
dnn_pool.c
theano/gpuarray/dnn_pool.c
+0
-4
dnn_pool_grad.c
theano/gpuarray/dnn_pool_grad.c
+0
-4
test_dnn.py
theano/gpuarray/tests/test_dnn.py
+0
-7
没有找到文件。
theano/gpuarray/dnn.py
浏览文件 @
109b378c
...
@@ -59,12 +59,12 @@ def _dnn_lib():
...
@@ -59,12 +59,12 @@ def _dnn_lib():
lib_name
=
ctypes
.
util
.
find_library
(
'cudnn'
)
lib_name
=
ctypes
.
util
.
find_library
(
'cudnn'
)
if
lib_name
is
None
and
sys
.
platform
==
'win32'
:
if
lib_name
is
None
and
sys
.
platform
==
'win32'
:
# Update these names when new versions of cudnn are supported.
# Update these names when new versions of cudnn are supported.
for
name
in
[
'cudnn64_5.dll'
,
'cudnn64_4.dll'
]:
for
name
in
[
'cudnn64_5.dll'
]:
lib_name
=
ctypes
.
util
.
find_library
(
name
)
lib_name
=
ctypes
.
util
.
find_library
(
name
)
if
lib_name
:
if
lib_name
:
break
break
if
lib_name
is
None
:
if
lib_name
is
None
:
raise
RuntimeError
(
'Could not find cudnn library (looked for v
4 and v
5[.1])'
)
raise
RuntimeError
(
'Could not find cudnn library (looked for v5[.1])'
)
_dnn_lib
.
handle
=
ctypes
.
cdll
.
LoadLibrary
(
lib_name
)
_dnn_lib
.
handle
=
ctypes
.
cdll
.
LoadLibrary
(
lib_name
)
cudnn
=
_dnn_lib
.
handle
cudnn
=
_dnn_lib
.
handle
cudnn
.
cudnnCreate
.
argtypes
=
[
ctypes
.
POINTER
(
ctypes
.
c_void_p
)]
cudnn
.
cudnnCreate
.
argtypes
=
[
ctypes
.
POINTER
(
ctypes
.
c_void_p
)]
...
@@ -129,7 +129,7 @@ if ((err = cudnnCreate(&_handle)) != CUDNN_STATUS_SUCCESS) {
...
@@ -129,7 +129,7 @@ if ((err = cudnnCreate(&_handle)) != CUDNN_STATUS_SUCCESS) {
def
_dnn_check_version
():
def
_dnn_check_version
():
v
=
version
()
v
=
version
()
if
v
<
4007
:
if
v
<
5000
:
return
False
,
"cuDNN version is too old. Update to v5, was
%
d."
%
v
return
False
,
"cuDNN version is too old. Update to v5, was
%
d."
%
v
return
True
,
None
return
True
,
None
...
@@ -500,10 +500,6 @@ class GpuDnnConv(DnnBase):
...
@@ -500,10 +500,6 @@ class GpuDnnConv(DnnBase):
if
self
.
inplace
:
if
self
.
inplace
:
self
.
destroy_map
=
{
0
:
[
2
]}
self
.
destroy_map
=
{
0
:
[
2
]}
if
version
()
<
5000
and
self
.
algo
==
'winograd'
:
raise
RuntimeError
(
"cuDNN winograd convolution requires "
"cuDNN v5 or more recent"
)
assert
self
.
algo
in
[
'none'
,
'small'
,
'large'
,
'fft'
,
'fft_tiling'
,
assert
self
.
algo
in
[
'none'
,
'small'
,
'large'
,
'fft'
,
'fft_tiling'
,
'winograd'
,
'guess_once'
,
'guess_on_shape_change'
,
'winograd'
,
'guess_once'
,
'guess_on_shape_change'
,
'time_once'
,
'time_on_shape_change'
]
'time_once'
,
'time_on_shape_change'
]
...
@@ -524,9 +520,9 @@ class GpuDnnConv(DnnBase):
...
@@ -524,9 +520,9 @@ class GpuDnnConv(DnnBase):
defs
.
append
((
'CONV_INPLACE'
,
'1'
))
defs
.
append
((
'CONV_INPLACE'
,
'1'
))
alg
=
'CUDNN_CONVOLUTION_FWD_ALGO_IMPLICIT_PRECOMP_GEMM'
alg
=
'CUDNN_CONVOLUTION_FWD_ALGO_IMPLICIT_PRECOMP_GEMM'
if
self
.
algo
==
'none'
:
# 3d
(at least in v4)
if
self
.
algo
==
'none'
:
# 3d
alg
=
'CUDNN_CONVOLUTION_FWD_ALGO_IMPLICIT_GEMM'
alg
=
'CUDNN_CONVOLUTION_FWD_ALGO_IMPLICIT_GEMM'
elif
self
.
algo
==
'small'
:
# 3d
(at least in v4)
elif
self
.
algo
==
'small'
:
# 3d
alg
=
'CUDNN_CONVOLUTION_FWD_ALGO_IMPLICIT_PRECOMP_GEMM'
alg
=
'CUDNN_CONVOLUTION_FWD_ALGO_IMPLICIT_PRECOMP_GEMM'
elif
self
.
algo
==
'large'
:
elif
self
.
algo
==
'large'
:
alg
=
'CUDNN_CONVOLUTION_FWD_ALGO_GEMM'
alg
=
'CUDNN_CONVOLUTION_FWD_ALGO_GEMM'
...
@@ -534,10 +530,9 @@ class GpuDnnConv(DnnBase):
...
@@ -534,10 +530,9 @@ class GpuDnnConv(DnnBase):
alg
=
'CUDNN_CONVOLUTION_FWD_ALGO_DIRECT'
alg
=
'CUDNN_CONVOLUTION_FWD_ALGO_DIRECT'
elif
self
.
algo
==
'fft'
:
elif
self
.
algo
==
'fft'
:
alg
=
'CUDNN_CONVOLUTION_FWD_ALGO_FFT'
alg
=
'CUDNN_CONVOLUTION_FWD_ALGO_FFT'
elif
self
.
algo
==
'fft_tiling'
:
# 3d
(not in v4, in v5)
elif
self
.
algo
==
'fft_tiling'
:
# 3d
alg
=
'CUDNN_CONVOLUTION_FWD_ALGO_FFT_TILING'
alg
=
'CUDNN_CONVOLUTION_FWD_ALGO_FFT_TILING'
elif
self
.
algo
==
'winograd'
:
elif
self
.
algo
==
'winograd'
:
# need v5
alg
=
'CUDNN_CONVOLUTION_FWD_ALGO_WINOGRAD'
alg
=
'CUDNN_CONVOLUTION_FWD_ALGO_WINOGRAD'
defs
.
append
((
'CONV_ALGO'
,
alg
))
defs
.
append
((
'CONV_ALGO'
,
alg
))
...
@@ -571,10 +566,6 @@ class GpuDnnConv(DnnBase):
...
@@ -571,10 +566,6 @@ class GpuDnnConv(DnnBase):
if
img
.
type
.
ndim
==
5
and
self
.
algo
in
[
'large'
,
'fft'
]:
if
img
.
type
.
ndim
==
5
and
self
.
algo
in
[
'large'
,
'fft'
]:
raise
ValueError
(
"convolution algo
%
s can't be used for "
raise
ValueError
(
"convolution algo
%
s can't be used for "
"3d convolutions"
,
(
self
.
algo
,))
"3d convolutions"
,
(
self
.
algo
,))
if
(
img
.
type
.
ndim
==
5
and
self
.
algo
in
[
'fft_tiling'
]
and
version
()
<
5000
):
raise
ValueError
(
"3d convolution algo fft_tiling need cudnn v5"
)
if
(
not
isinstance
(
desc
.
type
,
CDataType
)
or
if
(
not
isinstance
(
desc
.
type
,
CDataType
)
or
desc
.
type
.
ctype
!=
'cudnnConvolutionDescriptor_t'
):
desc
.
type
.
ctype
!=
'cudnnConvolutionDescriptor_t'
):
...
@@ -700,13 +691,13 @@ class GpuDnnConvGradW(DnnBase):
...
@@ -700,13 +691,13 @@ class GpuDnnConvGradW(DnnBase):
defs
.
append
((
'CONV_INPLACE'
,
'1'
))
defs
.
append
((
'CONV_INPLACE'
,
'1'
))
alg
=
'CUDNN_CONVOLUTION_BWD_FILTER_ALGO_0'
alg
=
'CUDNN_CONVOLUTION_BWD_FILTER_ALGO_0'
if
self
.
algo
==
'none'
:
# 3d
in at least v4
if
self
.
algo
==
'none'
:
# 3d
alg
=
'CUDNN_CONVOLUTION_BWD_FILTER_ALGO_0'
alg
=
'CUDNN_CONVOLUTION_BWD_FILTER_ALGO_0'
if
self
.
algo
==
'deterministic'
:
if
self
.
algo
==
'deterministic'
:
alg
=
'CUDNN_CONVOLUTION_BWD_FILTER_ALGO_1'
alg
=
'CUDNN_CONVOLUTION_BWD_FILTER_ALGO_1'
if
self
.
algo
==
'fft'
:
if
self
.
algo
==
'fft'
:
alg
=
'CUDNN_CONVOLUTION_BWD_FILTER_ALGO_FFT'
alg
=
'CUDNN_CONVOLUTION_BWD_FILTER_ALGO_FFT'
if
self
.
algo
==
'small'
:
# 3d
in at least v4
if
self
.
algo
==
'small'
:
# 3d
# non-deterministic, small workspace
# non-deterministic, small workspace
alg
=
'CUDNN_CONVOLUTION_BWD_FILTER_ALGO_3'
alg
=
'CUDNN_CONVOLUTION_BWD_FILTER_ALGO_3'
if
self
.
algo
in
[
'guess_once'
,
'guess_on_shape_change'
,
if
self
.
algo
in
[
'guess_once'
,
'guess_on_shape_change'
,
...
@@ -793,10 +784,6 @@ class GpuDnnConvGradI(DnnBase):
...
@@ -793,10 +784,6 @@ class GpuDnnConvGradI(DnnBase):
algo
=
config
.
dnn
.
conv
.
algo_bwd_data
algo
=
config
.
dnn
.
conv
.
algo_bwd_data
self
.
algo
=
algo
self
.
algo
=
algo
if
version
()
<
5000
and
self
.
algo
==
'winograd'
:
raise
RuntimeError
(
"cuDNN's winograd convolution requires cuDNN "
"v5 or more recent"
)
assert
self
.
algo
in
[
'none'
,
'deterministic'
,
'fft'
,
'fft_tiling'
,
assert
self
.
algo
in
[
'none'
,
'deterministic'
,
'fft'
,
'fft_tiling'
,
'winograd'
,
'guess_once'
,
'guess_on_shape_change'
,
'winograd'
,
'guess_once'
,
'guess_on_shape_change'
,
'time_once'
,
'time_on_shape_change'
]
'time_once'
,
'time_on_shape_change'
]
...
@@ -832,17 +819,16 @@ class GpuDnnConvGradI(DnnBase):
...
@@ -832,17 +819,16 @@ class GpuDnnConvGradI(DnnBase):
defs
.
append
((
'CONV_INPLACE'
,
'1'
))
defs
.
append
((
'CONV_INPLACE'
,
'1'
))
alg
=
'CUDNN_CONVOLUTION_BWD_DATA_ALGO_0'
alg
=
'CUDNN_CONVOLUTION_BWD_DATA_ALGO_0'
if
self
.
algo
==
'none'
:
# 3d
at least v4
if
self
.
algo
==
'none'
:
# 3d
alg
=
'CUDNN_CONVOLUTION_BWD_DATA_ALGO_0'
alg
=
'CUDNN_CONVOLUTION_BWD_DATA_ALGO_0'
elif
self
.
algo
==
'deterministic'
:
# 3d
at least v4
elif
self
.
algo
==
'deterministic'
:
# 3d
alg
=
'CUDNN_CONVOLUTION_BWD_DATA_ALGO_1'
alg
=
'CUDNN_CONVOLUTION_BWD_DATA_ALGO_1'
elif
self
.
algo
==
'fft'
:
elif
self
.
algo
==
'fft'
:
alg
=
'CUDNN_CONVOLUTION_BWD_DATA_ALGO_FFT'
alg
=
'CUDNN_CONVOLUTION_BWD_DATA_ALGO_FFT'
elif
self
.
algo
==
'fft_tiling'
:
# 3d
not v4, since v5
elif
self
.
algo
==
'fft_tiling'
:
# 3d
# big workspace but less than fft
# big workspace but less than fft
alg
=
'CUDNN_CONVOLUTION_BWD_DATA_ALGO_FFT_TILING'
alg
=
'CUDNN_CONVOLUTION_BWD_DATA_ALGO_FFT_TILING'
elif
self
.
algo
==
'winograd'
:
elif
self
.
algo
==
'winograd'
:
# need v5
alg
=
'CUDNN_CONVOLUTION_BWD_DATA_ALGO_WINOGRAD'
alg
=
'CUDNN_CONVOLUTION_BWD_DATA_ALGO_WINOGRAD'
if
self
.
algo
in
[
'guess_once'
,
'guess_on_shape_change'
,
if
self
.
algo
in
[
'guess_once'
,
'guess_on_shape_change'
,
...
@@ -877,10 +863,6 @@ class GpuDnnConvGradI(DnnBase):
...
@@ -877,10 +863,6 @@ class GpuDnnConvGradI(DnnBase):
if
kern
.
type
.
ndim
==
5
and
self
.
algo
in
[
'fft'
]:
if
kern
.
type
.
ndim
==
5
and
self
.
algo
in
[
'fft'
]:
raise
ValueError
(
"convolution algo
%
s can't be used for "
raise
ValueError
(
"convolution algo
%
s can't be used for "
"3d convolutions"
,
(
self
.
algo
,))
"3d convolutions"
,
(
self
.
algo
,))
if
(
kern
.
type
.
ndim
==
5
and
self
.
algo
==
'fft_tiling'
and
version
()
<
5000
):
raise
ValueError
(
"3d convolution algo fft_tiling need cudnn v5"
)
if
(
not
isinstance
(
desc
.
type
,
CDataType
)
or
if
(
not
isinstance
(
desc
.
type
,
CDataType
)
or
desc
.
type
.
ctype
!=
'cudnnConvolutionDescriptor_t'
):
desc
.
type
.
ctype
!=
'cudnnConvolutionDescriptor_t'
):
...
@@ -1316,11 +1298,7 @@ class GpuDnnPoolDesc(Op):
...
@@ -1316,11 +1298,7 @@ class GpuDnnPoolDesc(Op):
static const int pad[
%(nd)
d] = {
%(pad)
s};
static const int pad[
%(nd)
d] = {
%(pad)
s};
static const int str[
%(nd)
d] = {
%(str)
s};
static const int str[
%(nd)
d] = {
%(str)
s};
#if CUDNN_VERSION >= 5000
err = cudnnSetPoolingNdDescriptor(
%(desc)
s,
%(mode_flag)
s, CUDNN_PROPAGATE_NAN,
%(nd)
d, win, pad, str);
err = cudnnSetPoolingNdDescriptor(
%(desc)
s,
%(mode_flag)
s, CUDNN_PROPAGATE_NAN,
%(nd)
d, win, pad, str);
#else
err = cudnnSetPoolingNdDescriptor(
%(desc)
s,
%(mode_flag)
s,
%(nd)
d, win, pad, str);
#endif
if (err != CUDNN_STATUS_SUCCESS) {
if (err != CUDNN_STATUS_SUCCESS) {
PyErr_Format(PyExc_RuntimeError, "could not set op descriptor:
%%
s",
PyErr_Format(PyExc_RuntimeError, "could not set op descriptor:
%%
s",
...
@@ -1664,8 +1642,6 @@ class GpuDnnBatchNorm(DnnBase):
...
@@ -1664,8 +1642,6 @@ class GpuDnnBatchNorm(DnnBase):
DnnBase
.
__init__
(
self
,
[
'dnn_batchnorm_base.c'
,
'dnn_batchnorm.c'
],
DnnBase
.
__init__
(
self
,
[
'dnn_batchnorm_base.c'
,
'dnn_batchnorm.c'
],
'dnn_batchnorm_op'
)
'dnn_batchnorm_op'
)
if
version
()
<
5000
:
raise
RuntimeError
(
"cuDNN Batch Normalization requires cuDNN v5 or later"
)
assert
(
mode
in
(
'per-activation'
,
'spatial'
))
assert
(
mode
in
(
'per-activation'
,
'spatial'
))
self
.
mode
=
mode
self
.
mode
=
mode
...
@@ -1724,8 +1700,6 @@ class GpuDnnBatchNormInference(DnnBase):
...
@@ -1724,8 +1700,6 @@ class GpuDnnBatchNormInference(DnnBase):
DnnBase
.
__init__
(
self
,
[
'dnn_batchnorm_base.c'
,
'dnn_batchnorm_inf.c'
],
DnnBase
.
__init__
(
self
,
[
'dnn_batchnorm_base.c'
,
'dnn_batchnorm_inf.c'
],
'dnn_batchnorm_op'
)
'dnn_batchnorm_op'
)
if
version
()
<
5000
:
raise
RuntimeError
(
"cuDNN Batch Normalization requires cuDNN v5 or later"
)
assert
(
mode
in
(
'per-activation'
,
'spatial'
))
assert
(
mode
in
(
'per-activation'
,
'spatial'
))
self
.
mode
=
mode
self
.
mode
=
mode
...
@@ -1788,8 +1762,6 @@ class GpuDnnBatchNormGrad(DnnBase):
...
@@ -1788,8 +1762,6 @@ class GpuDnnBatchNormGrad(DnnBase):
DnnBase
.
__init__
(
self
,
[
'dnn_batchnorm_base.c'
,
'dnn_batchnorm_grad.c'
],
DnnBase
.
__init__
(
self
,
[
'dnn_batchnorm_base.c'
,
'dnn_batchnorm_grad.c'
],
'dnn_batchnorm_grad'
)
'dnn_batchnorm_grad'
)
if
version
()
<
5000
:
raise
RuntimeError
(
"cuDNN Batch Normalization requires cuDNN v5 or later"
)
assert
(
mode
in
(
'per-activation'
,
'spatial'
))
assert
(
mode
in
(
'per-activation'
,
'spatial'
))
self
.
mode
=
mode
self
.
mode
=
mode
...
...
theano/gpuarray/dnn_base.c
浏览文件 @
109b378c
...
@@ -115,11 +115,7 @@ c_set_filter(PyGpuArrayObject *var, cudnnFilterDescriptor_t desc) {
...
@@ -115,11 +115,7 @@ c_set_filter(PyGpuArrayObject *var, cudnnFilterDescriptor_t desc) {
if
(
nd
<
3
)
if
(
nd
<
3
)
nd
=
3
;
nd
=
3
;
#if CUDNN_VERSION >= 5000
err
=
cudnnSetFilterNdDescriptor
(
desc
,
dt
,
CUDNN_TENSOR_NCHW
,
nd
,
dims
);
err
=
cudnnSetFilterNdDescriptor
(
desc
,
dt
,
CUDNN_TENSOR_NCHW
,
nd
,
dims
);
#else
err
=
cudnnSetFilterNdDescriptor
(
desc
,
dt
,
nd
,
dims
);
#endif
if
(
err
!=
CUDNN_STATUS_SUCCESS
)
{
if
(
err
!=
CUDNN_STATUS_SUCCESS
)
{
PyErr_Format
(
PyExc_RuntimeError
,
PyErr_Format
(
PyExc_RuntimeError
,
...
...
theano/gpuarray/dnn_pool.c
浏览文件 @
109b378c
...
@@ -71,11 +71,7 @@ int APPLY_SPECIFIC(dnn_pool)(PyGpuArrayObject *img,
...
@@ -71,11 +71,7 @@ int APPLY_SPECIFIC(dnn_pool)(PyGpuArrayObject *img,
s
[
i
]
=
*
((
npy_intp
*
)
PyArray_GETPTR1
(
stride
,
i
));
s
[
i
]
=
*
((
npy_intp
*
)
PyArray_GETPTR1
(
stride
,
i
));
}
}
#if CUDNN_VERSION >= 5000
err
=
cudnnSetPoolingNdDescriptor
(
APPLY_SPECIFIC
(
pool
),
MODE_FLAG
,
CUDNN_PROPAGATE_NAN
,
ndims
,
w
,
p
,
s
);
err
=
cudnnSetPoolingNdDescriptor
(
APPLY_SPECIFIC
(
pool
),
MODE_FLAG
,
CUDNN_PROPAGATE_NAN
,
ndims
,
w
,
p
,
s
);
#else
err
=
cudnnSetPoolingNdDescriptor
(
APPLY_SPECIFIC
(
pool
),
MODE_FLAG
,
ndims
,
w
,
p
,
s
);
#endif
if
(
err
!=
CUDNN_STATUS_SUCCESS
)
{
if
(
err
!=
CUDNN_STATUS_SUCCESS
)
{
PyErr_Format
(
PyExc_RuntimeError
,
"could not set op descriptor %s"
,
cudnnGetErrorString
(
err
));
PyErr_Format
(
PyExc_RuntimeError
,
"could not set op descriptor %s"
,
cudnnGetErrorString
(
err
));
...
...
theano/gpuarray/dnn_pool_grad.c
浏览文件 @
109b378c
...
@@ -111,11 +111,7 @@ int APPLY_SPECIFIC(dnn_pool_grad)(PyGpuArrayObject *inp,
...
@@ -111,11 +111,7 @@ int APPLY_SPECIFIC(dnn_pool_grad)(PyGpuArrayObject *inp,
s
[
i
]
=
*
((
npy_intp
*
)
PyArray_GETPTR1
(
stride
,
i
));
s
[
i
]
=
*
((
npy_intp
*
)
PyArray_GETPTR1
(
stride
,
i
));
}
}
#if CUDNN_VERSION >= 5000
err
=
cudnnSetPoolingNdDescriptor
(
APPLY_SPECIFIC
(
pool
),
MODE_FLAG
,
CUDNN_PROPAGATE_NAN
,
ndims
,
w
,
p
,
s
);
err
=
cudnnSetPoolingNdDescriptor
(
APPLY_SPECIFIC
(
pool
),
MODE_FLAG
,
CUDNN_PROPAGATE_NAN
,
ndims
,
w
,
p
,
s
);
#else
err
=
cudnnSetPoolingNdDescriptor
(
APPLY_SPECIFIC
(
pool
),
MODE_FLAG
,
ndims
,
w
,
p
,
s
);
#endif
if
(
err
!=
CUDNN_STATUS_SUCCESS
)
{
if
(
err
!=
CUDNN_STATUS_SUCCESS
)
{
PyErr_Format
(
PyExc_RuntimeError
,
"could not set op descriptor %s"
,
cudnnGetErrorString
(
err
));
PyErr_Format
(
PyExc_RuntimeError
,
"could not set op descriptor %s"
,
cudnnGetErrorString
(
err
));
...
...
theano/gpuarray/tests/test_dnn.py
浏览文件 @
109b378c
...
@@ -604,9 +604,6 @@ class TestDnnInferShapes(utt.InferShapeTester):
...
@@ -604,9 +604,6 @@ class TestDnnInferShapes(utt.InferShapeTester):
[
conv_modes
[
0
]])),
[
conv_modes
[
0
]])),
testcase_func_name
=
utt
.
custom_name_func
)
testcase_func_name
=
utt
.
custom_name_func
)
def
test_conv
(
self
,
algo
,
border_mode
,
conv_mode
):
def
test_conv
(
self
,
algo
,
border_mode
,
conv_mode
):
if
algo
==
'winograd'
and
dnn
.
version
(
raises
=
False
)
<
5000
:
raise
SkipTest
(
dnn
.
dnn_available
.
msg
)
self
.
_test_conv
(
T
.
tensor4
(
'img'
),
self
.
_test_conv
(
T
.
tensor4
(
'img'
),
T
.
tensor4
(
'kerns'
),
T
.
tensor4
(
'kerns'
),
T
.
tensor4
(
'out'
),
T
.
tensor4
(
'out'
),
...
@@ -1361,8 +1358,6 @@ class test_SoftMax(test_nnet.test_SoftMax):
...
@@ -1361,8 +1358,6 @@ class test_SoftMax(test_nnet.test_SoftMax):
def
test_dnn_batchnorm_train
():
def
test_dnn_batchnorm_train
():
if
not
dnn
.
dnn_available
(
test_ctx_name
):
if
not
dnn
.
dnn_available
(
test_ctx_name
):
raise
SkipTest
(
dnn
.
dnn_available
.
msg
)
raise
SkipTest
(
dnn
.
dnn_available
.
msg
)
if
dnn
.
version
(
raises
=
False
)
<
5000
:
raise
SkipTest
(
"batch normalization requires cudnn v5+"
)
utt
.
seed_rng
()
utt
.
seed_rng
()
for
mode
in
(
'per-activation'
,
'spatial'
):
for
mode
in
(
'per-activation'
,
'spatial'
):
...
@@ -1416,8 +1411,6 @@ def test_dnn_batchnorm_train():
...
@@ -1416,8 +1411,6 @@ def test_dnn_batchnorm_train():
def
test_batchnorm_inference
():
def
test_batchnorm_inference
():
if
not
dnn
.
dnn_available
(
test_ctx_name
):
if
not
dnn
.
dnn_available
(
test_ctx_name
):
raise
SkipTest
(
dnn
.
dnn_available
.
msg
)
raise
SkipTest
(
dnn
.
dnn_available
.
msg
)
if
dnn
.
version
(
raises
=
False
)
<
5000
:
raise
SkipTest
(
"batch normalization requires cudnn v5+"
)
utt
.
seed_rng
()
utt
.
seed_rng
()
for
mode
in
(
'per-activation'
,
'spatial'
):
for
mode
in
(
'per-activation'
,
'spatial'
):
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论