提交 091f254d authored 作者: Frederic's avatar Frederic

make test pass in floatX.

上级 6a3c9ac7
...@@ -6336,18 +6336,18 @@ class TestSpecifyShape(unittest.TestCase): ...@@ -6336,18 +6336,18 @@ class TestSpecifyShape(unittest.TestCase):
specify_shape = SpecifyShape() specify_shape = SpecifyShape()
x = vector() x = vector()
xval = numpy.random.rand(2) xval = numpy.random.rand(2).astype(floatX)
f = theano.function([x], specify_shape(x, [2])) f = theano.function([x], specify_shape(x, [2]))
f(xval) f(xval)
xval = numpy.random.rand(3) xval = numpy.random.rand(3).astype(floatX)
self.assertRaises(AssertionError, f, xval) self.assertRaises(AssertionError, f, xval)
x = matrix() x = matrix()
xval = numpy.random.rand(2, 3) xval = numpy.random.rand(2, 3).astype(floatX)
f = theano.function([x], specify_shape(x, [2, 3])) f = theano.function([x], specify_shape(x, [2, 3]))
f(xval) f(xval)
for shape in [(1, 3), (2, 2), (5, 5)]: for shape in [(1, 3), (2, 2), (5, 5)]:
xval = numpy.random.rand(*shape) xval = numpy.random.rand(*shape).astype(floatX)
self.assertRaises(AssertionError, f, xval) self.assertRaises(AssertionError, f, xval)
def test_bad_number_of_shape(self): def test_bad_number_of_shape(self):
...@@ -6356,7 +6356,7 @@ class TestSpecifyShape(unittest.TestCase): ...@@ -6356,7 +6356,7 @@ class TestSpecifyShape(unittest.TestCase):
x = vector() x = vector()
shape_vec = ivector() shape_vec = ivector()
xval = numpy.random.rand(2) xval = numpy.random.rand(2).astype(floatX)
self.assertRaises(AssertionError, specify_shape, x, []) self.assertRaises(AssertionError, specify_shape, x, [])
self.assertRaises(AssertionError, specify_shape, x, [2, 2]) self.assertRaises(AssertionError, specify_shape, x, [2, 2])
...@@ -6365,7 +6365,7 @@ class TestSpecifyShape(unittest.TestCase): ...@@ -6365,7 +6365,7 @@ class TestSpecifyShape(unittest.TestCase):
self.assertRaises(AssertionError, f, xval, [2, 2]) self.assertRaises(AssertionError, f, xval, [2, 2])
x = matrix() x = matrix()
xval = numpy.random.rand(2, 3) xval = numpy.random.rand(2, 3).astype(floatX)
for shape in [(), for shape in [(),
(1,), (1,),
(2, 3, 4)]: (2, 3, 4)]:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论