parameters: (session, m, data, eval_op, verbose=False)
return_statement: return np.exp(costs / iters)
docstring: Runs the model on the given data.
docstring_summary: Runs the model on the given data.
docstring_tokens: Runs the model on the given data .
function: def run_epoch(session, m, data, eval_op, verbose=False):
    """Runs the model on the given data."""
    epoch_size = ((len(data) // m.batch_size) - 1) // m.num_steps
    start_time = time.time()
    costs = 0.0
    iters = 0
    state = m.initial_state.eval()
    for step, (x, y) in enumerate(reader.ptb_iterator(data, m.batch_size,
                                                      m.num_steps)):
      cost, state, _ = session.run([m.cost, m.final_state, eval_op],
                                   {m.input_data: x,
                                    m.targets: y,
                                    m.initial_state: state})
      costs += cost
      iters += m.num_steps
  
      if verbose and step % (epoch_size // 10) == 10:
        print("%.3f perplexity: %.3f speed: %.0f wps" %
              (step * 1.0 / epoch_size, np.exp(costs / iters),
               iters * m.batch_size / (time.time() - start_time)))
  
    return np.exp(costs / iters)
function_tokens: def run_epoch ( session , m , data , eval_op , verbose = False ) : epoch_size = ( ( len ( data ) // m . batch_size ) - 1 ) // m . num_steps start_time = time . time ( ) costs = 0.0 iters = 0 state = m . initial_state . eval ( ) for step , ( x , y ) in enumerate ( reader . ptb_iterator ( data , m . batch_size , m . num_steps ) ) : cost , state , _ = session . run ( [ m . cost , m . final_state , eval_op ] , { m . input_data : x , m . targets : y , m . initial_state : state } ) costs += cost iters += m . num_steps if verbose and step % ( epoch_size // 10 ) == 10 : print ( "%.3f perplexity: %.3f speed: %.0f wps" % ( step * 1.0 / epoch_size , np . exp ( costs / iters ) , iters * m . batch_size / ( time . time ( ) - start_time ) ) ) return np . exp ( costs / iters )