提交 6523bbdf authored 作者: Mathieu Germain's avatar Mathieu Germain

adressed comments

上级 03f2e31f
...@@ -165,7 +165,8 @@ def do_setup(): ...@@ -165,7 +165,8 @@ def do_setup():
# 1.7.0 give too much warning related to numpy.diagonal. # 1.7.0 give too much warning related to numpy.diagonal.
install_requires=['numpy>=1.7.1', 'scipy>=0.11', 'six>=1.9.0'], install_requires=['numpy>=1.7.1', 'scipy>=0.11', 'six>=1.9.0'],
extras_require={ extras_require={
'test': ['nose>=1.3.0', 'nose-parameterized>=0.5.0'] 'test': ['nose>=1.3.0', 'nose-parameterized>=0.5.0'],
'doc': ['Sphinx>=0.5.1']
}, },
package_data={ package_data={
'': ['*.txt', '*.rst', '*.cu', '*.cuh', '*.c', '*.sh', '*.pkl', '': ['*.txt', '*.rst', '*.cu', '*.cuh', '*.c', '*.sh', '*.pkl',
......
...@@ -430,7 +430,7 @@ class TestDnnInferShapes(utt.InferShapeTester): ...@@ -430,7 +430,7 @@ class TestDnnInferShapes(utt.InferShapeTester):
dnn.GpuDnnSoftmaxGrad dnn.GpuDnnSoftmaxGrad
) )
def _test_conv(self, img, kerns, out, img_val, kern_vals, border_mode, conv_mode, subsamples): def _test_conv(self, img, kerns, out, img_val, kern_vals, border_mode, conv_mode, subsamples, algo):
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)
...@@ -448,7 +448,7 @@ class TestDnnInferShapes(utt.InferShapeTester): ...@@ -448,7 +448,7 @@ class TestDnnInferShapes(utt.InferShapeTester):
subsample=subsample, subsample=subsample,
conv_mode=conv_mode conv_mode=conv_mode
)(kerns.shape) )(kerns.shape)
conv = dnn.GpuDnnConv()(img, kerns, out, desc) conv = dnn.GpuDnnConv(algo=algo)(img, kerns, out, desc)
self._compile_and_check( self._compile_and_check(
[img, kerns, out], [img, kerns, out],
[conv], [conv],
...@@ -464,38 +464,28 @@ class TestDnnInferShapes(utt.InferShapeTester): ...@@ -464,38 +464,28 @@ 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):
try: self._test_conv(T.ftensor4('img'),
default_algo = theano.config.dnn.conv.algo_fwd T.ftensor4('kerns'),
theano.config.dnn.conv.algo_fwd = algo T.ftensor4('out'),
numpy.random.rand(7, 2, 8, 4),
self._test_conv(T.ftensor4('img'), numpy.random.rand(8, 2, 4, 3),
T.ftensor4('kerns'), border_mode,
T.ftensor4('out'), conv_mode,
numpy.random.rand(7, 2, 8, 4), [(1, 1), (2, 2)],
numpy.random.rand(8, 2, 4, 3), algo)
border_mode,
conv_mode,
[(1, 1), (2, 2)])
finally:
theano.config.dnn.conv.algo_fwd = default_algo
@parameterized.expand(product(border_modes, conv_modes), utt.custom_name_func) @parameterized.expand(product(border_modes, conv_modes), utt.custom_name_func)
def test_conv3d_none(self, border_mode, conv_mode): def test_conv3d_none(self, border_mode, conv_mode):
try: ftensor5 = T.TensorType(dtype="float32", broadcastable=(False,) * 5)
default_algo = theano.config.dnn.conv.algo_fwd self._test_conv(ftensor5('img'),
theano.config.dnn.conv.algo_fwd = 'none' ftensor5('kerns'),
ftensor5('out'),
ftensor5 = T.TensorType(dtype="float32", broadcastable=(False,) * 5) numpy.random.rand(10, 2, 6, 4, 11),
self._test_conv(ftensor5('img'), numpy.random.rand(8, 2, 4, 3, 1),
ftensor5('kerns'), border_mode,
ftensor5('out'), conv_mode,
numpy.random.rand(10, 2, 6, 4, 11), [(1, 1, 1), (2, 2, 2)],
numpy.random.rand(8, 2, 4, 3, 1), 'none')
border_mode,
conv_mode,
[(1, 1, 1), (2, 2, 2)])
finally:
theano.config.dnn.conv.algo_fwd = default_algo
def _test_conv_gradw(self, img, kerns, out, img_val, kern_vals, border_mode, conv_mode, subsample): def _test_conv_gradw(self, img, kerns, out, img_val, kern_vals, border_mode, conv_mode, subsample):
if not dnn.dnn_available(test_ctx_name): if not dnn.dnn_available(test_ctx_name):
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论