def pred_probs(f_log_probs, options, worddict, prepare_data, data, iterator, verbose=False):
 n_samples = len(data[0])
 probs = numpy.zeros((n_samples, 1)).astype('float32')
 n_done = 0
 for (_, valid_index) in iterator:
  (x, mask, ctx) = prepare_data([data[0][t] for t in valid_index], data[1], worddict, maxlen=None, n_words=options['n_words'])
  pred_probs = f_log_probs(x, mask, ctx)
  probs[valid_index] = pred_probs[:, None]
  n_done += len(valid_index)
  if verbose:
   print ('%d/%d samples computed' % (n_done, n_samples))
 return probs

def pred_probs ( f_log_probs , options , worddict , prepare_data , data , iterator , verbose = False ) : n_samples = len ( data [ 0 ] ) probs = numpy . zeros ( ( n_samples , 1 ) ) . astype ( 'float32' ) n_done = 0 for ( _ , valid_index ) in iterator : ( x , mask , ctx ) = prepare_data ( [ data [ 0 ] [ t ] for t in valid_index ] , data [ 1 ] , worddict , maxlen = None , n_words = options [ 'n_words' ] ) pred_probs = f_log_probs ( x , mask , ctx ) probs [ valid_index ] = pred_probs [ : , None ] n_done += len ( valid_index ) if verbose : print ( '%d/%d samples computed' % ( n_done , n_samples ) ) return probs
if you want to use a trained model .