#NEWLINE# def gpuarray_shared_constructor( value , name = None , strict = False , allow_downcast = None , borrow = False , broadcastable = None , target = None ) : #NEWLINE# #INDENT# '\n    SharedVariable constructor for GpuArrayType.\n\n    See :func:`theano.shared`.\n\n    ' #NEWLINE# if ( ( target == 'gpu' ) or ( target == 'cpu' ) ) : #NEWLINE# #INDENT# raise TypeError ( 'not for me' ) #NEWLINE# #UNINDENT# if ( not isinstance ( value , ( numpy . ndarray , pygpu . gpuarray . GpuArray ) ) ) : #NEWLINE# #INDENT# raise TypeError ( 'ndarray or GpuArray required' ) #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# get_context ( target ) #NEWLINE# #UNINDENT# except ContextNotDefined : #NEWLINE# #INDENT# if ( target is None ) : #NEWLINE# #INDENT# raise TypeError ( 'No default context and no context specified' ) #NEWLINE# #UNINDENT# raise #NEWLINE# #UNINDENT# if ( broadcastable is None ) : #NEWLINE# #INDENT# broadcastable = ( ( False , ) * value . ndim ) #NEWLINE# #UNINDENT# type = GpuArrayType ( value . dtype , broadcastable , context_name = target ) #NEWLINE# deviceval = pygpu . gpuarray . array ( value , copy = ( not borrow ) , context = type . context ) #NEWLINE# return GpuArraySharedVariable ( type = type , value = deviceval , name = name , strict = strict )