def test_GPU_nstreams_limit():
 if (not cuda_available):
  raise SkipTest('Optional package cuda not available')
 seed = 12345
 R = MRG_RandomStreams(seed=seed, use_cuda=True)
 def eval_uniform(size, nstreams):
  if (theano.config.mode == 'FAST_COMPILE'):
   mode = 'FAST_RUN'
  else:
   mode = copy.copy(theano.compile.get_default_mode())
   mode.check_py_code = False
  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_GPU_nstreams_limit ( ) : if ( not cuda_available ) : raise SkipTest ( 'Optional package cuda not available' ) seed = 12345 R = MRG_RandomStreams ( seed = seed , use_cuda = True ) def eval_uniform ( size , nstreams ) : if ( theano . config . mode == 'FAST_COMPILE' ) : mode = 'FAST_RUN' else : mode = copy . copy ( theano . compile . get_default_mode ( ) ) mode . check_py_code = False 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 ) )
verify that a valueerror is raised when n_streams is greater than 2**20 on gpu .