提交 bd12b2d5 authored 作者: Frederic's avatar Frederic

Raise test tolerang for reduction on big shape. CPU and GPU do not round/add in the same way

上级 bf0f7ee7
# Skip test if cuda_ndarray is not available. # Skip test if cuda_ndarray is not available.
import itertools
from nose.plugins.skip import SkipTest from nose.plugins.skip import SkipTest
import numpy as np
import theano.sandbox.cuda as cuda_ndarray import theano.sandbox.cuda as cuda_ndarray
if cuda_ndarray.cuda_available is False: if cuda_ndarray.cuda_available is False:
...@@ -14,10 +17,10 @@ else: ...@@ -14,10 +17,10 @@ else:
mode_with_gpu = theano.compile.mode.get_default_mode().including('gpu') mode_with_gpu = theano.compile.mode.get_default_mode().including('gpu')
from theano import tensor as T from theano import tensor as T
import numpy as np
import theano import theano
from theano.tensor.extra_ops import cumsum, CumsumOp from theano.tensor.extra_ops import cumsum, CumsumOp
import itertools from theano.tests import unittest_tools as utt
class TestGpuCumsum(theano.tensor.tests.test_extra_ops.TestCumsumOp): class TestGpuCumsum(theano.tensor.tests.test_extra_ops.TestCumsumOp):
mode = mode_with_gpu mode = mode_with_gpu
...@@ -154,7 +157,7 @@ class TestGpuCumsum(theano.tensor.tests.test_extra_ops.TestCumsumOp): ...@@ -154,7 +157,7 @@ class TestGpuCumsum(theano.tensor.tests.test_extra_ops.TestCumsumOp):
a_shape = [5, 5] a_shape = [5, 5]
a_shape[1-shape_axis] = self.max_grid_size1+1 a_shape[1-shape_axis] = self.max_grid_size1+1
a = np.random.random(a_shape).astype("float32") a = np.random.random(a_shape).astype("float32")
assert np.allclose(np.cumsum(a, axis=axis), f(a)) utt.assert_allclose(np.cumsum(a, axis=axis), f(a), rtol=5e-5)
# Use recursive cumsum # Use recursive cumsum
a_shape = [3, 3] a_shape = [3, 3]
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论