title: tensorflow add summary during graph execution
body: <p>I want to output the accuracy every <strong>fixed amount of steps</strong> in the cifar10 example given by the tensorflow tutorial, I tried using the <code>tf.summary.scalar(..)</code> in the hook which produces the error: Graph is finalized. However, I think I can only access the number of steps in the hook (I'm evaluating the accuracy use cifar10_eval.py, also an example code given by the tensorflow tutorial). I also tried to write the <code>global_step</code> into the checkpoint but unfortunately the <code>MointeredTrainingSession</code> only supports the time interval(<code>save_checkpoint_secs</code>) instead of step interval. Any suggestions?</p>
  
  <p>cifar10_train.py</p>
  
  <pre><code>def train():
    """Train CIFAR-10 for a number of steps."""
    with tf.Graph().as_default():
      global_step = tf.contrib.framework.get_or_create_global_step()
  
      # Build a Graph that trains the model with one batch of examples and
      # updates the model parameters.
      train_op = cifar10.train(loss, global_step)
  
      class _LoggerHook(tf.train.SessionRunHook):
        """Logs loss and runtime."""
  
        def begin(self):
          self._step = -1
          self._start_time = time.time()
  
        def before_run(self, run_context):
          self._step += 1
          return tf.train.SessionRunArgs(loss)  # Asks for loss value.
  
        def after_run(self, run_context, run_values):
          &lt;output some information&gt;
  
      with tf.train.MonitoredTrainingSession(
          checkpoint_dir=FLAGS.train_dir,
          hooks=[tf.train.StopAtStepHook(last_step=FLAGS.max_steps),
                 tf.train.NanTensorHook(loss),
                 _LoggerHook()],
          config=tf.ConfigProto(
              log_device_placement=FLAGS.log_device_placement)) as mon_sess:
        while not mon_sess.should_stop():
          mon_sess.run(train_op)
  </code></pre>