提交 2aa1e4ac authored 作者: Olivier Delalleau's avatar Olivier Delalleau

Again, a few more tests fixed in float32

上级 3ab93519
...@@ -358,7 +358,7 @@ class T_SharedRandomStreams(unittest.TestCase): ...@@ -358,7 +358,7 @@ class T_SharedRandomStreams(unittest.TestCase):
def test_vector_arguments(self): def test_vector_arguments(self):
random = RandomStreams(utt.fetch_seed()) random = RandomStreams(utt.fetch_seed())
low = tensor.dvector() low = tensor.dvector()
out = random.uniform(low=low, high=1) out = random.uniform(low=low, high=1, dtype='float64')
assert out.ndim == 1 assert out.ndim == 1
f = function([low], out) f = function([low], out)
...@@ -372,7 +372,7 @@ class T_SharedRandomStreams(unittest.TestCase): ...@@ -372,7 +372,7 @@ class T_SharedRandomStreams(unittest.TestCase):
assert numpy.all(val1 == numpy_val1) assert numpy.all(val1 == numpy_val1)
high = tensor.vector() high = tensor.vector()
outb = random.uniform(low=low, high=high) outb = random.uniform(low=low, high=high, dtype='float64')
assert outb.ndim == 1 assert outb.ndim == 1
fb = function([low, high], outb) fb = function([low, high], outb)
...@@ -388,7 +388,7 @@ class T_SharedRandomStreams(unittest.TestCase): ...@@ -388,7 +388,7 @@ class T_SharedRandomStreams(unittest.TestCase):
#self.assertRaises(ValueError, fb, [-4., -2], [-1]) #self.assertRaises(ValueError, fb, [-4., -2], [-1])
size = tensor.lvector() size = tensor.lvector()
outc = random.uniform(low=low, high=high, size=size, ndim=1) outc = random.uniform(low=low, high=high, size=size, ndim=1, dtype='float64')
fc = function([low, high, size], outc) fc = function([low, high, size], outc)
numpy_rng = numpy.random.RandomState(int(seed_gen.randint(2**30))) numpy_rng = numpy.random.RandomState(int(seed_gen.randint(2**30)))
...@@ -431,7 +431,7 @@ class T_SharedRandomStreams(unittest.TestCase): ...@@ -431,7 +431,7 @@ class T_SharedRandomStreams(unittest.TestCase):
random = RandomStreams(utt.fetch_seed()) random = RandomStreams(utt.fetch_seed())
low = tensor.dvector() low = tensor.dvector()
high = tensor.dvector() high = tensor.dvector()
out = random.uniform(low=low, high=high) out = random.uniform(low=low, high=high, dtype='float64')
assert out.ndim == 1 assert out.ndim == 1
f = function([low, high], out) f = function([low, high], out)
...@@ -455,7 +455,7 @@ class T_SharedRandomStreams(unittest.TestCase): ...@@ -455,7 +455,7 @@ class T_SharedRandomStreams(unittest.TestCase):
assert numpy.all(val1 == numpy_val1) assert numpy.all(val1 == numpy_val1)
# Specifying the size explicitly # Specifying the size explicitly
g = function([low, high], random.uniform(low=low, high=high, size=(3,))) g = function([low, high], random.uniform(low=low, high=high, size=(3,), dtype='float64'))
val2 = g(low_val, high_val) val2 = g(low_val, high_val)
numpy_rng = numpy.random.RandomState(int(seed_gen.randint(2**30))) numpy_rng = numpy.random.RandomState(int(seed_gen.randint(2**30)))
numpy_val2 = numpy_rng.uniform(low=low_val, high=high_val, size=(3,)) numpy_val2 = numpy_rng.uniform(low=low_val, high=high_val, size=(3,))
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论