提交 b2f99581 authored 作者: Frederic Bastien's avatar Frederic Bastien

Better test update for python 32bit fix

上级 bdfe90b7
......@@ -726,6 +726,9 @@ def repeat(x, repeats, axis=None):
if repeats.ndim == 1:
repeats = repeats[0]
if x.dtype == ('uint64',):
raise TypeError("theano.tensor.repeat don't support dtype uint64")
if axis is None:
axis = 0
x = x.flatten()
......
......@@ -423,8 +423,9 @@ class TestRepeatOp(utt.InferShapeTester):
for dtype in tensor.discrete_dtypes:
r_var = T.scalar(dtype=dtype)
r = numpy.asarray(3, dtype=dtype)
if dtype in self.numpy_unsupported_dtypes:
r_var = T.vector(dtype=dtype)
if (dtype in self.numpy_unsupported_dtypes and
# uint64 is always not implemented
(r_var.ndim == 1 or dtype == 'uint64')):
self.assertRaises(TypeError,
repeat, x, r_var, axis=axis)
else:
......@@ -441,10 +442,14 @@ class TestRepeatOp(utt.InferShapeTester):
r = np.random.random_integers(
5, size=(10,)).astype(dtype)
f = theano.function([x, r_var],
repeat(x, r_var, axis=axis))
assert np.allclose(np.repeat(a, r, axis=axis),
f(a, r))
if dtype in self.numpy_unsupported_dtypes and r_var.ndim == 1:
self.assertRaises(TypeError,
repeat, x, r_var, axis=axis)
else:
f = theano.function([x, r_var],
repeat(x, r_var, axis=axis))
assert np.allclose(np.repeat(a, r, axis=axis),
f(a, r))
#check when r is a list of single integer, e.g. [3].
r = np.random.random_integers(10, size=()).astype(dtype) + 2
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论