提交 2ac4b4ca authored 作者: Pascal Lamblin's avatar Pascal Lamblin

Refactor strides tests to also run on CPU

And it seems a good idea, since several are failing...
上级 5ba4af1e
...@@ -18,7 +18,7 @@ import theano.sandbox.cuda as tcn ...@@ -18,7 +18,7 @@ import theano.sandbox.cuda as tcn
from theano.tensor.signal.downsample import DownsampleFactorMax, DownsampleFactorMaxGrad from theano.tensor.signal.downsample import DownsampleFactorMax, DownsampleFactorMaxGrad
import theano.compile.mode import theano.compile.mode
from theano.tensor.tests.test_blas import BaseGemv, TestGer from theano.tensor.tests.test_blas import BaseGemv, TestBlasStrides, TestGer
from theano.sandbox.cuda.blas import gpu_gemv_no_inplace, gpu_gemv_inplace from theano.sandbox.cuda.blas import gpu_gemv_no_inplace, gpu_gemv_inplace
from theano.sandbox.cuda.blas import gpu_ger_inplace, gpu_ger_no_inplace from theano.sandbox.cuda.blas import gpu_ger_inplace, gpu_ger_no_inplace
...@@ -167,6 +167,11 @@ def test_gemm_no_inplace(): ...@@ -167,6 +167,11 @@ def test_gemm_no_inplace():
cmp((0,0),(0,0)) cmp((0,0),(0,0))
class TestBlasStridesGpu(TestBlasStrides):
dtype = 'float32'
shared = staticmethod(tcn.shared_constructor)
mode = mode_with_gpu
def test_dot22_strides(): def test_dot22_strides():
def cmp(b_shp, c_shp): def cmp(b_shp, c_shp):
av = numpy.zeros((0, 0), dtype='float32') av = numpy.zeros((0, 0), dtype='float32')
......
import sys import sys
import numpy import numpy
from unittest import TestCase
import theano import theano
import theano.tensor as tensor import theano.tensor as tensor
...@@ -14,8 +16,7 @@ from theano.tensor.blas import Gemv ...@@ -14,8 +16,7 @@ from theano.tensor.blas import Gemv
from theano.tests import unittest_tools from theano.tests import unittest_tools
from theano.tests.unittest_tools import TestOptimizationMixin from theano.tests.unittest_tools import TestOptimizationMixin
from test_blas import TestCase from theano.tensor.tests.test_blas import BaseGemv, TestBlasStrides
from test_blas import BaseGemv
mode_blas_opt = theano.compile.get_default_mode().including( mode_blas_opt = theano.compile.get_default_mode().including(
'BlasOpt', 'specialize', 'InplaceBlasOpt', 'c_blas') 'BlasOpt', 'specialize', 'InplaceBlasOpt', 'c_blas')
...@@ -238,3 +239,6 @@ class TestCGemvFloat64(TestCase, BaseGemv, TestOptimizationMixin): ...@@ -238,3 +239,6 @@ class TestCGemvFloat64(TestCase, BaseGemv, TestOptimizationMixin):
dtype = 'float64' dtype = 'float64'
gemv = CGemv(inplace=False) gemv = CGemv(inplace=False)
gemv_inplace = CGemv(inplace=True) gemv_inplace = CGemv(inplace=True)
class TestBlasStridesC(TestBlasStrides):
mode = mode_blas_opt
...@@ -4,7 +4,7 @@ import theano ...@@ -4,7 +4,7 @@ import theano
import theano.tensor as tensor import theano.tensor as tensor
from theano.tensor.blas_scipy import ScipyGer from theano.tensor.blas_scipy import ScipyGer
from test_blas import TestCase, gemm_no_inplace from test_blas import TestCase, gemm_no_inplace, TestBlasStrides
from theano.tests.unittest_tools import TestOptimizationMixin from theano.tests.unittest_tools import TestOptimizationMixin
class TestScipyGer(TestCase, TestOptimizationMixin): class TestScipyGer(TestCase, TestOptimizationMixin):
...@@ -56,3 +56,7 @@ class TestScipyGer(TestCase, TestOptimizationMixin): ...@@ -56,3 +56,7 @@ class TestScipyGer(TestCase, TestOptimizationMixin):
0.2 * self.A + 0.1 * tensor.outer(self.x, self.y)) 0.2 * self.A + 0.1 * tensor.outer(self.x, self.y))
self.assertFunctionContains(f, gemm_no_inplace) self.assertFunctionContains(f, gemm_no_inplace)
self.run_f(f) #DebugMode tests correctness self.run_f(f) #DebugMode tests correctness
class TestBlasStridesScipy(TestBlasStrides):
mode = theano.compile.get_default_mode()
mode = mode.including('fast_run').excluding('gpu', 'c_blas')
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论