def test_consistency_cpu_serial():
 seed = 12345
 n_samples = 5
 n_streams = 12
 n_substreams = 7
 samples = []
 curr_rstate = numpy.array(([seed] * 6), dtype='int32')
 for i in range(n_streams):
  stream_rstate = curr_rstate.copy()
  for j in range(n_substreams):
   rstate = theano.shared(numpy.array([stream_rstate.copy()], dtype='int32'))
   (new_rstate, sample) = rng_mrg.mrg_uniform.new(rstate, ndim=None, dtype=config.floatX, size=(1,))
   sample.rstate = rstate
   sample.update = (rstate, new_rstate)
   rstate.default_update = new_rstate
   f = theano.function([], sample)
   for k in range(n_samples):
    s = f()
    samples.append(s)
   stream_rstate = rng_mrg.ff_2p72(stream_rstate)
  curr_rstate = rng_mrg.ff_2p134(curr_rstate)
 samples = numpy.array(samples).flatten()
 assert numpy.allclose(samples, java_samples)

def test_consistency_cpu_serial ( ) : seed = 12345 n_samples = 5 n_streams = 12 n_substreams = 7 samples = [ ] curr_rstate = numpy . array ( ( [ seed ] * 6 ) , dtype = 'int32' ) for i in range ( n_streams ) : stream_rstate = curr_rstate . copy ( ) for j in range ( n_substreams ) : rstate = theano . shared ( numpy . array ( [ stream_rstate . copy ( ) ] , dtype = 'int32' ) ) ( new_rstate , sample ) = rng_mrg . mrg_uniform . new ( rstate , ndim = None , dtype = config . floatX , size = ( 1 , ) ) sample . rstate = rstate sample . update = ( rstate , new_rstate ) rstate . default_update = new_rstate f = theano . function ( [ ] , sample ) for k in range ( n_samples ) : s = f ( ) samples . append ( s ) stream_rstate = rng_mrg . ff_2p72 ( stream_rstate ) curr_rstate = rng_mrg . ff_2p134 ( curr_rstate ) samples = numpy . array ( samples ) . flatten ( ) assert numpy . allclose ( samples , java_samples )
verify that the random numbers generated by mrg_uniform .