W3cubDocs

/TensorFlow Python

tf.train.summary_iterator

tf.train.summary_iterator(path)

Defined in tensorflow/python/summary/summary_iterator.py.

See the guide: Training > Reading Summaries from Event Files

An iterator for reading Event protocol buffers from an event file.

You can use this function to read events written to an event file. It returns a Python iterator that yields Event protocol buffers.

Example: Print the contents of an events file.

for e in tf.train.summary_iterator(path to events file):
    print(e)

Example: Print selected summary values.

# This example supposes that the events file contains summaries with a
# summary value tag 'loss'.  These could have been added by calling
# `add_summary()`, passing the output of a scalar summary op created with
# with: `tf.summary.scalar('loss', loss_tensor)`.
for e in tf.train.summary_iterator(path to events file):
    for v in e.summary.value:
        if v.tag == 'loss':
            print(v.simple_value)

See the protocol buffer definitions of Event and Summary for more information about their attributes.

Args:

  • path: The path to an event file created by a SummaryWriter.

Yields:

Event protocol buffers.

© 2018 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/api_docs/python/tf/train/summary_iterator