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