#NEWLINE# def compute_output( model , subset ) : #NEWLINE# #INDENT# if isinstance ( subset . input , list ) : #NEWLINE# #INDENT# ( X , S ) = subset . input #NEWLINE# f = theano . function ( inputs = model . input , outputs = model . output , on_unused_input = 'ignore' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# X = subset . input #NEWLINE# f = theano . function ( inputs = [ model . input ] , outputs = model . output , on_unused_input = 'ignore' ) #NEWLINE# #UNINDENT# m = X . cpu_data . shape [ 0 ] #NEWLINE# batch_size = 100 #NEWLINE# n_batches = ( ( ( m - 1 ) // batch_size ) + 1 ) #NEWLINE# output = [ ] #NEWLINE# if isinstance ( subset . input , list ) : #NEWLINE# #INDENT# for i in xrange ( n_batches ) : #NEWLINE# #INDENT# output . append ( f ( X . cpu_data [ ( i * batch_size ) : ( ( i + 1 ) * batch_size ) ] , S . cpu_data [ ( i * batch_size ) : ( ( i + 1 ) * batch_size ) ] ) ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# for i in xrange ( n_batches ) : #NEWLINE# #INDENT# output . append ( f ( X . cpu_data [ ( i * batch_size ) : ( ( i + 1 ) * batch_size ) ] ) ) #NEWLINE# #UNINDENT# #UNINDENT# output = np . vstack ( output ) #NEWLINE# return output