提交 99cffe57 authored 作者: Kelvin Xu's avatar Kelvin Xu

passing tests

上级 ba81f75f
...@@ -43,7 +43,7 @@ class GpuCumsum(CumsumOp, GpuOp): ...@@ -43,7 +43,7 @@ class GpuCumsum(CumsumOp, GpuOp):
if x.ndim > GpuCumsum.SUPPORTED_NDIMS: if x.ndim > GpuCumsum.SUPPORTED_NDIMS:
raise NotImplementedError('Only cumsum on 1D, 2D and 3D array are supported right now!') raise NotImplementedError('Only cumsum on 1D, 2D and 3D array are supported right now!')
print(self.axis)
if self.axis >= x.ndim or self.axis < -x.ndim: if self.axis >= x.ndim or self.axis < -x.ndim:
raise ValueError('axis(={1}) out of bounds'.format(self.axis)) raise ValueError('axis(={1}) out of bounds'.format(self.axis))
......
...@@ -53,6 +53,7 @@ class TestGpuCumsum(theano.tensor.tests.test_extra_ops.TestCumsumOp): ...@@ -53,6 +53,7 @@ class TestGpuCumsum(theano.tensor.tests.test_extra_ops.TestCumsumOp):
a = np.random.random((42,)).astype("float32") a = np.random.random((42,)).astype("float32")
cumsum_function = theano.function([x], cumsum(x, axis=axis), cumsum_function = theano.function([x], cumsum(x, axis=axis),
mode=self.mode) mode=self.mode)
theano.printing.debugprint(cumsum_function)
slicings = [slice(None, None, None), # Normal strides slicings = [slice(None, None, None), # Normal strides
slice(None, None, 2), # Stepped strides slice(None, None, 2), # Stepped strides
......
...@@ -12,7 +12,7 @@ import theano.tensor.tests.test_extra_ops ...@@ -12,7 +12,7 @@ import theano.tensor.tests.test_extra_ops
from theano.tensor.extra_ops import cumsum, CumsumOp from theano.tensor.extra_ops import cumsum, CumsumOp
from theano.tests import unittest_tools as utt from theano.tests import unittest_tools as utt
from .config import mode_with_gpu, test_ctx_name, test_ctx from .config import mode_with_gpu, test_ctx_name
from ..extra_ops import GpuCumsum from ..extra_ops import GpuCumsum
from ..type import get_context from ..type import get_context
...@@ -22,10 +22,11 @@ class TestGpuCumsum(theano.tensor.tests.test_extra_ops.TestCumsumOp): ...@@ -22,10 +22,11 @@ class TestGpuCumsum(theano.tensor.tests.test_extra_ops.TestCumsumOp):
def setUp(self): def setUp(self):
super(TestGpuCumsum, self).setUp() super(TestGpuCumsum, self).setUp()
if get_context(test_ctx_name).kind != 'cuda': test_ctx = get_context(test_ctx_name)
if test_ctx.kind != 'cuda':
raise SkipTest("Cuda specific tests") raise SkipTest("Cuda specific tests")
self.max_threads_dim0 = test_ctx.maxlsize0 self.max_threads_dim0 = test_ctx.maxlsize0
self.max_grid_size1 = test_ctx.maxgsize1 self.max_grid_size1 = test_ctx.maxgsize2
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论