提交 1b1d95fa authored 作者: Pascal Lamblin's avatar Pascal Lamblin

Revert changes to test after new update to upcasting mechanism of random func.

Revert f46a8b820217, 90b692809391 and 6d8724480dab.
上级 e9e58bfd
...@@ -185,7 +185,7 @@ class T_random_function(unittest.TestCase): ...@@ -185,7 +185,7 @@ class T_random_function(unittest.TestCase):
broadcastable=(False, True, True))() broadcastable=(False, True, True))()
high = tensor.TensorType(dtype='float64', high = tensor.TensorType(dtype='float64',
broadcastable=(True, True, True, False))() broadcastable=(True, True, True, False))()
post_out2, out2 = uniform(rng_R, size=None, ndim=2, low=low, high=high, dtype='float64') post_out2, out2 = uniform(rng_R, size=None, ndim=2, low=low, high=high)
self.assertEqual(out2.ndim, 4) self.assertEqual(out2.ndim, 4)
self.assertEqual(out2.broadcastable, (True,False,True,False)) self.assertEqual(out2.broadcastable, (True,False,True,False))
...@@ -585,7 +585,7 @@ class T_random_function(unittest.TestCase): ...@@ -585,7 +585,7 @@ class T_random_function(unittest.TestCase):
rng_R = random_state_type() rng_R = random_state_type()
low = tensor.dvector() low = tensor.dvector()
high = tensor.dcol() high = tensor.dcol()
post_r, out = uniform(rng_R, low=low, high=high, dtype='float64') post_r, out = uniform(rng_R, low=low, high=high)
assert out.ndim == 2 assert out.ndim == 2
f = compile.function([rng_R, low, high], [post_r, out], accept_inplace=True) f = compile.function([rng_R, low, high], [post_r, out], accept_inplace=True)
......
...@@ -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, dtype='float64') out = random.uniform(low=low, high=1)
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, dtype='float64') outb = random.uniform(low=low, high=high)
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, dtype='float64') outc = random.uniform(low=low, high=high, size=size, ndim=1)
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)))
...@@ -409,7 +409,7 @@ class T_SharedRandomStreams(unittest.TestCase): ...@@ -409,7 +409,7 @@ class T_SharedRandomStreams(unittest.TestCase):
random = RandomStreams(utt.fetch_seed()) random = RandomStreams(utt.fetch_seed())
low = tensor.dvector() low = tensor.dvector()
high = tensor.dcol() high = tensor.dcol()
out = random.uniform(low=low, high=high, dtype='float64') out = random.uniform(low=low, high=high)
assert out.ndim == 2 assert out.ndim == 2
f = function([low, high], out) f = function([low, high], out)
...@@ -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, dtype='float64') out = random.uniform(low=low, high=high)
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,), dtype='float64')) g = function([low, high], random.uniform(low=low, high=high, size=(3,)))
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 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论