提交 eaa13c81 authored 作者: Pascal Lamblin's avatar Pascal Lamblin

Use parameter 'p' instead of 'prob' in binomial(), as the latter is deprecated.

上级 e9f0c710
...@@ -515,12 +515,12 @@ class T_RandomStreams(unittest.TestCase): ...@@ -515,12 +515,12 @@ class T_RandomStreams(unittest.TestCase):
m.random = RandomStreams(utt.fetch_seed()) m.random = RandomStreams(utt.fetch_seed())
n = tensor.lvector() n = tensor.lvector()
prob = tensor.vector() prob = tensor.vector()
out = m.random.binomial(n=n, prob=prob) out = m.random.binomial(n=n, p=prob)
assert out.ndim == 1 assert out.ndim == 1
m.f = Method([n, prob], out) m.f = Method([n, prob], out)
# Specifying the size explicitly # Specifying the size explicitly
m.g = Method([n, prob], m.g = Method([n, prob],
m.random.binomial(n=n, prob=prob, size=(3,))) m.random.binomial(n=n, p=prob, size=(3,)))
made = m.make() made = m.make()
made.random.initialize() made.random.initialize()
......
...@@ -592,7 +592,7 @@ class T_random_function(unittest.TestCase): ...@@ -592,7 +592,7 @@ class T_random_function(unittest.TestCase):
rng_R = random_state_type() rng_R = random_state_type()
n = tensor.lvector() n = tensor.lvector()
prob = tensor.vector() prob = tensor.vector()
post_r, out = binomial(rng_R, n=n, prob=prob) post_r, out = binomial(rng_R, n=n, p=prob)
assert out.ndim == 1 assert out.ndim == 1
f = compile.function([rng_R, n, prob], [post_r, out], accept_inplace=True) f = compile.function([rng_R, n, prob], [post_r, out], accept_inplace=True)
...@@ -613,7 +613,7 @@ class T_random_function(unittest.TestCase): ...@@ -613,7 +613,7 @@ class T_random_function(unittest.TestCase):
# Specifying the size explicitly # Specifying the size explicitly
g = compile.function([rng_R, n, prob], g = compile.function([rng_R, n, prob],
binomial(rng_R, n=n, prob=prob, size=(3,)), binomial(rng_R, n=n, p=prob, size=(3,)),
accept_inplace=True) accept_inplace=True)
rng2, val2 = g(rng1, n_val, prob_val) rng2, val2 = g(rng1, n_val, prob_val)
numpy_val2 = numpy_rng.binomial(n=n_val, p=prob_val, size=(3,)) numpy_val2 = numpy_rng.binomial(n=n_val, p=prob_val, size=(3,))
......
...@@ -465,7 +465,7 @@ class T_SharedRandomStreams(unittest.TestCase): ...@@ -465,7 +465,7 @@ class T_SharedRandomStreams(unittest.TestCase):
random = RandomStreams(utt.fetch_seed()) random = RandomStreams(utt.fetch_seed())
n = tensor.lvector() n = tensor.lvector()
prob = tensor.vector() prob = tensor.vector()
out = random.binomial(n=n, prob=prob) out = random.binomial(n=n, p=prob)
assert out.ndim == 1 assert out.ndim == 1
f = function([n, prob], out) f = function([n, prob], out)
...@@ -485,7 +485,7 @@ class T_SharedRandomStreams(unittest.TestCase): ...@@ -485,7 +485,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([n, prob], random.binomial(n=n, prob=prob, size=(3,))) g = function([n, prob], random.binomial(n=n, p=prob, size=(3,)))
val2 = g(n_val, prob_val) val2 = g(n_val, prob_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.binomial(n=n_val, p=prob_val, size=(3,)) numpy_val2 = numpy_rng.binomial(n=n_val, p=prob_val, size=(3,))
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论