#NEWLINE# def validate_by_minibatch( valid_fn , cfg ) : #NEWLINE# #INDENT# valid_sets = cfg . valid_sets #NEWLINE# valid_xy = cfg . valid_xy #NEWLINE# batch_size = cfg . batch_size #NEWLINE# valid_error = [ ] #NEWLINE# while ( not valid_sets . is_finish ( ) ) : #NEWLINE# #INDENT# valid_sets . load_next_partition ( valid_xy ) #NEWLINE# for batch_index in xrange ( ( valid_sets . cur_frame_num / batch_size ) ) : #NEWLINE# #INDENT# valid_error . append ( valid_fn ( index = batch_index ) ) #NEWLINE# #UNINDENT# #UNINDENT# valid_sets . initialize_read ( ) #NEWLINE# return batch_index