def test2(shape=(3, 4, 5)):
 gpu = theano.sandbox.cuda.basic_ops.gpu_from_host
 U = gpu(theano.tensor.ftensor3('U'))
 theano.function([U], gpu((U + 1)))
 A = numpy.random.rand(*shape).astype('float32')
 A_cnd = theano.sandbox.cuda.CudaNdarray(A)
 A_gar = cudandarray_to_garray(A_cnd)
 assert (A_cnd.shape == A_gar.shape)
 B = garray_to_cudandarray(A_gar)
 assert (A_cnd.shape == B.shape)
 assert (A_cnd._strides == B._strides)
 assert (A_cnd.gpudata == B.gpudata)
 v = numpy.asarray(B)
 assert (v == A).all()

def test2 ( shape = ( 3 , 4 , 5 ) ) : gpu = theano . sandbox . cuda . basic_ops . gpu_from_host U = gpu ( theano . tensor . ftensor3 ( 'U' ) ) theano . function ( [ U ] , gpu ( ( U + 1 ) ) ) A = numpy . random . rand ( * shape ) . astype ( 'float32' ) A_cnd = theano . sandbox . cuda . CudaNdarray ( A ) A_gar = cudandarray_to_garray ( A_cnd ) assert ( A_cnd . shape == A_gar . shape ) B = garray_to_cudandarray ( A_gar ) assert ( A_cnd . shape == B . shape ) assert ( A_cnd . _strides == B . _strides ) assert ( A_cnd . gpudata == B . gpudata ) v = numpy . asarray ( B ) assert ( v == A ) . all ( )
shortcut test for the reportlab distribution with modified options .