提交 fba43e24 authored 作者: Pascal Lamblin's avatar Pascal Lamblin

Slight refactor of conv3d2d tests

That way it can work with @parameterized and GPU
上级 65a5c2d4
...@@ -3,12 +3,14 @@ This file test tensor op that should also operate on CudaNdaray. ...@@ -3,12 +3,14 @@ This file test tensor op that should also operate on CudaNdaray.
""" """
from __future__ import absolute_import, print_function, division from __future__ import absolute_import, print_function, division
from nose.plugins.skip import SkipTest from nose.plugins.skip import SkipTest
from nose_parameterized import parameterized
import numpy import numpy
import theano import theano
from theano import tensor from theano import tensor
import theano.tensor as T import theano.tensor as T
import theano.tests.unittest_tools as utt
# Skip test if cuda_ndarray is not available. # Skip test if cuda_ndarray is not available.
import theano.sandbox.cuda as cuda import theano.sandbox.cuda as cuda
...@@ -139,6 +141,8 @@ def test_get_diagonal_subtensor_view(): ...@@ -139,6 +141,8 @@ def test_get_diagonal_subtensor_view():
test_conv3d2d.test_get_diagonal_subtensor_view(wrap=cuda.CudaNdarray) test_conv3d2d.test_get_diagonal_subtensor_view(wrap=cuda.CudaNdarray)
def test_conv3d(): @parameterized.expand(('valid', 'full'), utt.custom_name_func)
test_conv3d2d.test_conv3d(mode=mode_with_gpu, def test_conv3d(border_mode):
shared=cuda.shared_constructor) test_conv3d2d.check_conv3d(border_mode=border_mode,
mode=mode_with_gpu,
shared=cuda.shared_constructor)
...@@ -92,7 +92,15 @@ def check_diagonal_subtensor_view_traces(fn): ...@@ -92,7 +92,15 @@ def check_diagonal_subtensor_view_traces(fn):
@parameterized.expand(('valid', 'full'), utt.custom_name_func) @parameterized.expand(('valid', 'full'), utt.custom_name_func)
def test_conv3d(border_mode, mode=mode_without_gpu, shared=theano.tensor._shared): def test_conv3d(border_mode):
check_conv3d(border_mode=border_mode,
mode=mode_without_gpu,
shared=theano.tensor._shared)
# This function will also be used in theano/sandbox/cuda/tests/test_tensor_op.py,
# which is not possible if it is decorated by @parameterized.expand
def check_conv3d(border_mode, mode=mode_without_gpu, shared=theano.tensor._shared):
if ndimage is None: if ndimage is None:
raise SkipTest("conv3d2d tests need SciPy") raise SkipTest("conv3d2d tests need SciPy")
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论