title: Visualise optimization process in TensorFlow averaged over batches
body: <p>I want to use TensorBoard to visualize the optimization process (i.e. how the loss is decreasing over the minimization steps). For that I use summaries. In the graph I have the following:</p>
  
  <pre><code>global_step = tf.Variable(0, dtype=tf.int64, trainable=False, name="global_step")
  tf_loss = ...
  tf_minimize = optimizer.minimize(tf_loss, var_list=[...], global_step=global_step)
  summaries = {"mysummary": tf.summary.merge([tf.summary.scalar("loss", tf.reduce_mean(tf_loss))])}
  </code></pre>
  
  <p>Optimization process with logging of summaries then looks like this:</p>
  
  <pre><code>timestamp = datetime.now().strftime("%Y-%m-%d_%H%M%S")
  summary_writer = tf.summary.FileWriter(("{}/{}").format('logs', timestamp), flush_secs=10)
  
  for batch in data:
      with tf.Session() as sess:
          _, sm = sess.run([tf_minimize, summaries["mysummary"]])
          summary_writer.add_summary(sm, sess.run(global_step))
  </code></pre>
  
  <p>The problem is that so far TensorBoard is showing several points in the graph for each minimization step. However, I would like to visualize the learning process averaged over batches i.e. for each global_step I would like to see the average loss.</p>
  
  <p>Is there some more convenient way of doing it then making a 1D tensor of size of the maximum number of steps and store there the averages manually?</p>