code: def summarize_metrics(eval_metrics_writer, metrics, epoch):
    
    for (name, value) in six.iteritems(metrics):
      summary = tf.Summary()
      summary.value.add(tag=name, simple_value=value)
      eval_metrics_writer.add_summary(summary, epoch)
    eval_metrics_writer.flush()
docs: Write metrics to summary.