提交 d32810b9 authored 作者: Frederic Bastien's avatar Frederic Bastien

Add the same restriction to the perform to return the same error and have test…

Add the same restriction to the perform to return the same error and have test don't use more then 9G of RAM.
上级 22b943c3
...@@ -345,14 +345,19 @@ class mrg_uniform(mrg_uniform_base): ...@@ -345,14 +345,19 @@ class mrg_uniform(mrg_uniform_base):
rstate, size = inp rstate, size = inp
o_rstate, o_sample = out o_rstate, o_sample = out
n_elements = 1 n_elements = 1
for s in size:
n_elements *= s
if n_elements > M1:
# The limit is on the C and GPU code. This perform don't
# have this limit. But to have all of them behave the
# same (and have DebugMode don't use too much memory for
# some rng_mrg tests) I also add this limit here.
raise ValueError("rng_mrg does not support more then (2**31 -1) samples")
rstate = numpy.asarray(rstate) # bring state from GPU if necessary rstate = numpy.asarray(rstate) # bring state from GPU if necessary
if not self.inplace: if not self.inplace:
rstate = rstate.copy() rstate = rstate.copy()
for s in size:
n_elements *= s
n_streams, _ = rstate.shape n_streams, _ = rstate.shape
rval = numpy.zeros(n_elements, dtype=self.output_type.dtype) rval = numpy.zeros(n_elements, dtype=self.output_type.dtype)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论