#NEWLINE# def test_gpueye( ) : #NEWLINE# #INDENT# def check( dtype , N , M_ = None , K = 0 ) : #NEWLINE# #INDENT# M = M_ #NEWLINE# if ( M is None ) : #NEWLINE# #INDENT# M = N #NEWLINE# #UNINDENT# N_symb = T . iscalar ( ) #NEWLINE# M_symb = T . iscalar ( ) #NEWLINE# k_symb = numpy . asarray ( K ) #NEWLINE# out = T . eye ( N_symb , M_symb , k_symb , dtype = dtype ) #NEWLINE# f = theano . function ( [ N_symb , M_symb ] , B . as_cuda_ndarray_variable ( out ) , mode = mode_with_gpu ) #NEWLINE# result = numpy . asarray ( f ( N , M ) ) #NEWLINE# utt . assert_allclose ( result , numpy . eye ( N , M_ , K , dtype = dtype ) ) #NEWLINE# assert ( result . dtype == numpy . dtype ( dtype ) ) #NEWLINE# if ( K == 0 ) : #NEWLINE# #INDENT# assert any ( [ isinstance ( node . op , B . GpuEye ) for node in f . maker . fgraph . toposort ( ) ] ) #NEWLINE# #UNINDENT# #UNINDENT# for dtype in [ 'float32' ] : #NEWLINE# #INDENT# ( yield ( check , dtype , 3 ) ) #NEWLINE# ( yield ( check , dtype , 3 , 5 ) ) #NEWLINE# ( yield ( check , dtype , 5 , 3 ) ) #NEWLINE# ( yield ( check , dtype , 5 , 3 , 1 ) )