tf.compat.v1.train.summary_iterator
Stay organized with collections
Save and categorize content based on your preferences.
Returns a iterator for reading Event
protocol buffers from an event file.
tf.compat.v1.train.summary_iterator(
path
)
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):
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.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':
print(tf.make_ndarray(v.tensor))
Example: Continuously check for new summary values.
summaries = tf.compat.v1.train.summary_iterator(path to events file)
while True:
for e in summaries:
for v in e.summary.value:
if v.tag == 'loss':
print(tf.make_ndarray(v.tensor))
# Wait for a bit before checking the file for any new events
time.sleep(wait time)
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 .
|
Returns |
A iterator that yields Event protocol buffers
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates. Some content is licensed under the numpy license.
Last updated 2024-04-26 UTC.
[null,null,["Last updated 2024-04-26 UTC."],[],[],null,["# tf.compat.v1.train.summary_iterator\n\n\u003cbr /\u003e\n\n|--------------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v2.16.1/tensorflow/python/summary/summary_iterator.py#L39-L91) |\n\nReturns a iterator for reading `Event` protocol buffers from an event file. \n\n tf.compat.v1.train.summary_iterator(\n path\n )\n\nYou can use this function to read events written to an event file. It returns\na Python iterator that yields `Event` protocol buffers.\n\nExample: Print the contents of an events file. \n\n for e in tf.compat.v1.train.summary_iterator(path to events file):\n print(e)\n\nExample: Print selected summary values. \n\n # This example supposes that the events file contains summaries with a\n # summary value tag 'loss'. These could have been added by calling\n # `add_summary()`, passing the output of a scalar summary op created with\n # with: `tf.compat.v1.summary.scalar('loss', loss_tensor)`.\n for e in tf.compat.v1.train.summary_iterator(path to events file):\n for v in e.summary.value:\n if v.tag == 'loss':\n print(tf.make_ndarray(v.tensor))\n\nExample: Continuously check for new summary values. \n\n summaries = tf.compat.v1.train.summary_iterator(path to events file)\n while True:\n for e in summaries:\n for v in e.summary.value:\n if v.tag == 'loss':\n print(tf.make_ndarray(v.tensor))\n # Wait for a bit before checking the file for any new events\n time.sleep(wait time)\n\nSee the protocol buffer definitions of\n[Event](https://www.tensorflow.org/code/tensorflow/core/util/event.proto)\nand\n[Summary](https://www.tensorflow.org/code/tensorflow/core/framework/summary.proto)\nfor more information about their attributes.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|--------|---------------------------------------------------------|\n| `path` | The path to an event file created by a `SummaryWriter`. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|---|---|\n| A iterator that yields `Event` protocol buffers ||\n\n\u003cbr /\u003e"]]