#NEWLINE# def check_uniform_basic( shape_as_symbolic , dim_as_symbolic = False ) : #NEWLINE# #INDENT# '\n    check_uniform_basic(shape_as_symbolic, dim_as_symbolic=False)\n\n    Runs a basic sanity check on the `uniform` method of a\n    `CURAND_RandomStreams` object.\n\n    Checks that variates\n\n     * are in the range [0, 1]\n     * have a mean in the right neighbourhood (near 0.5)\n     * are of the specified shape\n     * successive calls produce different arrays of variates\n\n    Parameters\n    ----------\n    shape_as_symbolic : boolean\n        If `True`, est the case that the shape tuple is a symbolic\n        variable rather than known at compile-time.\n\n    dim_as_symbolic : boolean\n        If `True`, test the case that an element of the shape\n        tuple is a Theano symbolic. Irrelevant if `shape_as_symbolic`\n        is `True`.\n    ' #NEWLINE# rng = CURAND_RandomStreams ( 234 ) #NEWLINE# if shape_as_symbolic : #NEWLINE# #INDENT# shape = constant ( ( 10 , 10 ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if dim_as_symbolic : #NEWLINE# #INDENT# shape = ( 10 , constant ( 10 ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# shape = ( 10 , 10 ) #NEWLINE# #UNINDENT# #UNINDENT# u0 = rng . uniform ( shape ) #NEWLINE# u1 = rng . uniform ( shape ) #NEWLINE# f0 = theano . function ( [ ] , u0 , mode = mode_with_gpu ) #NEWLINE# f1 = theano . function ( [ ] , u1 , mode = mode_with_gpu ) #NEWLINE# v0list = [ f0 ( ) for i in range ( 3 ) ] #NEWLINE# v1list = [ f1 ( ) for i in range ( 3 ) ] #NEWLINE# assert numpy . all ( ( v0list [ 0 ] != v0list [ 1 ] ) ) #NEWLINE# assert numpy . all ( ( v1list [ 0 ] != v1list [ 1 ] ) ) #NEWLINE# assert numpy . all ( ( dim_as_symbolic [ 0 ] != v1list [ 0 ] ) ) #NEWLINE# for v in v0list : #NEWLINE# #INDENT# assert ( v . shape == ( 10 , 10 ) ) #NEWLINE# assert ( v . min ( ) >= 0 ) #NEWLINE# assert ( v . max ( ) <= 1 ) #NEWLINE# assert ( v . min ( ) < v . max ( ) ) #NEWLINE# assert ( 0.25 <= v . mean ( ) <= 0.75 )