Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to manually create a tf.Summary()

Tags:

tensorflow

I often want to log python variables --as opposed to tf tensors.

In the docs it says that "you can pass a tf.Summary protocol buffer that you populate with your own data" but there is no docs for tf.Summary and i could not figure out how to use it.

Anyone knows how to create a Scalar summary this way?

like image 856
Carles Gelada Avatar asked Jun 19 '16 00:06

Carles Gelada


People also ask

What is TF summary?

The tf. summary module provides APIs for writing summary data. This data can be visualized in TensorBoard, the visualization toolkit that comes with TensorFlow. See the TensorBoard website for more detailed tutorials about how to use these APIs, or some quick examples below.

What does TF summary FileWriter do?

The FileWriter class provides a mechanism to create an event file in a given directory and add summaries and events to it. The class updates the file contents asynchronously. This allows a training program to call methods to add data to the file directly from the training loop, without slowing down training.


1 Answers

You can create a tf.Summary object in your Python program and write it to the same tf.summary.FileWriter object that takes your TensorFlow-produced summaries using the SummaryWriter.add_summary() method.

The tf.Summary class is a Python protocol buffer wrapper for the Summary protocol buffer. Each Summary contains a list of tf.Summary.Value protocol buffers, which each have a tag and a either a "simple" (floating-point scalar) value, an image, a histogram, or an audio snippet. For example, you can generate a scalar summary from a Python object as follows:

writer = tf.train.SummaryWriter(...) value = 37.0 summary = tf.Summary(value=[     tf.Summary.Value(tag="summary_tag", simple_value=value),  ]) writer.add_summary(summary) 
like image 118
mrry Avatar answered Sep 19 '22 14:09

mrry