#NEWLINE# def speed_adv_sub1( ) : #NEWLINE# #INDENT# data = numpy . random . rand ( 50000 , 21 ) . astype ( 'float32' ) #NEWLINE# var = tcn . shared_constructor ( data ) #NEWLINE# vec = tensor . lvector ( ) #NEWLINE# for batch_size in [ 100 , 1000 , 10000 , 100000 ] : #NEWLINE# #INDENT# idx = numpy . random . randint ( 0 , 50000 , batch_size ) #NEWLINE# mode_with_gpu = theano . compile . ProfileMode ( ) . including ( 'gpu' ) #NEWLINE# f = theano . function ( [ vec ] , var [ vec ] , mode = idx ) #NEWLINE# for i in range ( 100 ) : #NEWLINE# #INDENT# f ( idx ) #NEWLINE# #UNINDENT# print ( 'ProfileMode with batch size' , batch_size ) #NEWLINE# mode_with_gpu . print_summary ( )