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?
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.
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.
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)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With