Skip to content

Commit

Permalink
fix test in FAST_COMPILE
Browse files Browse the repository at this point in the history
  • Loading branch information
nouiz committed Oct 23, 2014
1 parent b1ca006 commit bbf5269
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions theano/sandbox/test_rng_mrg.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ def test_consistency_GPU_parallel():
samples = numpy.array(samples).flatten()
assert(numpy.allclose(samples, java_samples))


def test_GPU_nstreams_limit():
"""Verify that a ValueError is raised when n_streams
is greater than 2**20 on GPU. This is the value of
Expand All @@ -316,13 +317,20 @@ def test_GPU_nstreams_limit():

seed = 12345
R = MRG_RandomStreams(seed=seed, use_cuda=True)

def eval_uniform(size, nstreams):
return R.uniform(size=size, nstreams=nstreams, dtype='float32').eval()

if theano.config.mode == "FAST_COMPILE":
mode = "FAST_RUN"
else:
mode = None
out = R.uniform(size=size, nstreams=nstreams, dtype='float32')
f = theano.function([], out, mode=mode)
return f()

eval_uniform((10,), 2**20)
assert_raises(ValueError, eval_uniform, (10,), 2**20 + 1)


def test_consistency_GPUA_serial():
'''Verify that the random numbers generated by GPUA_mrg_uniform, serially,
are the same as the reference (Java) implementation by L'Ecuyer et al.
Expand Down

0 comments on commit bbf5269

Please sign in to comment.