TF 2.0 is out! Get hands-on practice at TF World, Oct 28-31. Use code TF20 for 20% off select passes. Register now


View source on GitHub

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.compat.v1.train.summary_iterator(path to events file):

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.compat.v1.summary.scalar('loss', loss_tensor)`.
for e in tf.compat.v1.train.summary_iterator(path to events file):
    for v in e.summary.value:
        if v.tag == 'loss':

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


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


Event protocol buffers.