提交 65262ef7 authored 作者: Nicolas Ballas's avatar Nicolas Ballas 提交者: Pascal Lamblin

enable cpu version

上级 28e99288
...@@ -11,14 +11,16 @@ import theano.tensor.nnet.abstract_conv2d as conv ...@@ -11,14 +11,16 @@ import theano.tensor.nnet.abstract_conv2d as conv
from theano.sandbox.cuda import float32_shared_constructor as shared from theano.sandbox.cuda import float32_shared_constructor as shared
from theano.sandbox.cuda.tests.test_conv_cuda_ndarray import py_conv from theano.sandbox.cuda.tests.test_conv_cuda_ndarray import py_conv
from theano.sandbox.cuda.dnn import dnn_available
if theano.config.mode == 'FAST_COMPILE': if theano.config.mode == 'FAST_COMPILE':
mode_with_gpu = theano.compile.mode.get_mode('FAST_RUN').including('gpu') mode_with_gpu = theano.compile.mode.get_mode('FAST_RUN').including('gpu')
mode_without_gpu = theano.compile.mode.get_default_mode().excluding('gpu')
else: else:
mode_with_gpu = theano.compile.mode.get_default_mode().including('gpu') mode_with_gpu = theano.compile.mode.get_default_mode().including('gpu')
mode_without_gpu = theano.compile.mode.get_default_mode().excluding('gpu')
from theano.sandbox.cuda.dnn import dnn_available
class TestConv2d(unittest.TestCase): class TestConv2d(unittest.TestCase):
...@@ -111,21 +113,16 @@ class TestConv2d(unittest.TestCase): ...@@ -111,21 +113,16 @@ class TestConv2d(unittest.TestCase):
def test_valid(self): def test_valid(self):
mode = mode_with_gpu mode = mode_with_gpu
# if dnn_available(): if dnn_available():
# self.run_conv(inputs_shape=(16, 1, 2, 2), self.run_conv(inputs_shape=(16, 1, 2, 2),
# filters_shape=(10, 1, 2, 2), filters_shape=(10, 1, 2, 2),
# verify_grad=False) verify_grad=False, mode=mode)
# # self.run_conv(inputs_shape=(16, 1, 8, 8), self.run_gradweight(inputs_shape=(16, 1, 2, 2),
# # filters_shape=(10, 1, 2, 2), filters_shape=(10, 1, 2, 2),
# # subsample=(2, 2), verify_grad=False, mode=mode)
# # verify_grad=False) self.run_gradinput(inputs_shape=(1, 1, 2, 2),
# self.run_conv(inputs_shape=(16, 1, 2, 2), filters_shape=(10, 1, 2, 2),
# filters_shape=(10, 1, 2, 2), verify_grad=False, mode=mode)
# verify_grad=True)
# # self.run_conv(inputs_shape=(16, 1, 8, 8),
# # filters_shape=(10, 1, 2, 2),
# # subsample=(2, 2),
# # verify_grad=True)
mode = mode.excluding('cudnn') mode = mode.excluding('cudnn')
self.run_conv(inputs_shape=(16, 1, 2, 2), self.run_conv(inputs_shape=(16, 1, 2, 2),
...@@ -138,6 +135,17 @@ class TestConv2d(unittest.TestCase): ...@@ -138,6 +135,17 @@ class TestConv2d(unittest.TestCase):
filters_shape=(10, 1, 2, 2), filters_shape=(10, 1, 2, 2),
verify_grad=False, mode=mode) verify_grad=False, mode=mode)
mode = mode_without_gpu
self.run_conv(inputs_shape=(16, 1, 2, 2),
filters_shape=(10, 1, 2, 2),
verify_grad=False, mode=mode)
self.run_gradweight(inputs_shape=(16, 1, 2, 2),
filters_shape=(10, 1, 2, 2),
verify_grad=False, mode=mode)
self.run_gradinput(inputs_shape=(1, 1, 2, 2),
filters_shape=(10, 1, 2, 2),
verify_grad=False, mode=mode)
# self.run_conv(inputs_shape=(16, 1, 8, 8), # self.run_conv(inputs_shape=(16, 1, 8, 8),
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论