提交 49e91567 authored 作者: slefrancois's avatar slefrancois

fix tests for python<2.7

上级 5f0572d8
......@@ -22,7 +22,7 @@ if not pycuda_available: # noqa
raise SkipTest('Optional package pycuda not available')
# Transform sizes
N = 64
N = 32
class TestFFT(unittest.TestCase):
......@@ -244,14 +244,13 @@ class TestFFT(unittest.TestCase):
utt.verify_grad(f_irfft, [inputs_val], eps=eps)
def test_params(self):
inputs_val = np.random.random((1, N)).astype('float32')
inputs_val = numpy.random.random((1, N)).astype('float32')
inputs = theano.shared(inputs_val)
with self.assertRaises(ValueError):
theano.gpuarray.fft.curfft(inputs, norm=123)
inputs_val = np.random.random((1, N // 2 + 1, 2)).astype('float32')
self.assertRaises(ValueError, theano.gpuarray.fft.curfft, inputs, norm=123)
inputs_val = numpy.random.random((1, N // 2 + 1, 2)).astype('float32')
inputs = theano.shared(inputs_val)
with self.assertRaises(ValueError):
theano.gpuarray.fft.cuirfft(inputs, norm=123)
with self.assertRaises(ValueError):
theano.gpuarray.fft.cuirfft(inputs, is_odd=123)
self.assertRaises(ValueError, theano.gpuarray.fft.cuirfft, inputs, norm=123)
self.assertRaises(ValueError, theano.gpuarray.fft.cuirfft, inputs, is_odd=123)
......@@ -151,15 +151,14 @@ class TestFFT(unittest.TestCase):
def test_params(self):
inputs_val = numpy.random.random((1, N))
inputs = theano.shared(inputs_val)
with self.assertRaises(ValueError):
fft.rfft(inputs, norm=123)
self.assertRaises(ValueError, fft.rfft, inputs, norm=123)
inputs_val = numpy.random.random((1, N // 2 + 1, 2))
inputs = theano.shared(inputs_val)
with self.assertRaises(ValueError):
fft.irfft(inputs, norm=123)
with self.assertRaises(ValueError):
fft.irfft(inputs, is_odd=123)
self.assertRaises(ValueError, fft.irfft, inputs, norm=123)
self.assertRaises(ValueError, fft.irfft, inputs, is_odd=123)
def test_grad_rfft(self):
# The numerical gradient of the FFT is sensitive, must set large
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论