#NEWLINE# def _predict_loop( self , f , ins , batch_size = 32 , verbose = 0 ) : #NEWLINE# #INDENT# 'Abstract method to loop over some data in batches.\n\n        # Arguments\n            f: Keras function returning a list of tensors.\n            ins: list of tensors to be fed to `f`.\n            batch_size: integer batch size.\n            verbose: verbosity mode.\n\n        # Returns\n            Array of prections (if the model has a single output)\n            or list of arrays of predictions\n            (if the model has multiple outputs).\n        ' #NEWLINE# nb_sample = len ( ins [ 0 ] ) #NEWLINE# outs = [ ] #NEWLINE# if ( verbose == 1 ) : #NEWLINE# #INDENT# progbar = Progbar ( target = nb_sample ) #NEWLINE# #UNINDENT# batches = make_batches ( nb_sample , ins_batch ) #NEWLINE# index_array = np . arange ( nb_sample ) #NEWLINE# for ( batch_index , ( batch_start , batch_end ) ) in enumerate ( batches ) : #NEWLINE# #INDENT# batch_ids = index_array [ batch_start : batch_end ] #NEWLINE# if ( type ( ins [ ( - 1 ) ] ) is float ) : #NEWLINE# #INDENT# ins_batch = ( slice_X ( ins [ : ( - 1 ) ] , batch_ids ) + [ ins [ ( - 1 ) ] ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# ins_batch = slice_X ( ins , batch_ids ) #NEWLINE# #UNINDENT# batch_outs = f ( ins_batch ) #NEWLINE# if ( type ( batch_outs ) != list ) : #NEWLINE# #INDENT# batch_outs = [ batch_outs ] #NEWLINE# #UNINDENT# if ( batch_index == 0 ) : #NEWLINE# #INDENT# for batch_out in batch_outs : #NEWLINE# #INDENT# shape = ( ( nb_sample , ) + batch_out . shape [ 1 : ] ) #NEWLINE# outs . append ( np . zeros ( shape ) ) #NEWLINE# #UNINDENT# #UNINDENT# for ( i , batch_out ) in enumerate ( batch_outs ) : #NEWLINE# #INDENT# outs [ i ] [ batch_start : batch_end ] = batch_out #NEWLINE# #UNINDENT# if ( verbose == 1 ) : #NEWLINE# #INDENT# progbar . update ( batch_end ) #NEWLINE# #UNINDENT# #UNINDENT# if ( len ( outs ) == 1 ) : #NEWLINE# #INDENT# return outs [ 0 ] #NEWLINE# #UNINDENT# return outs