tf.compat.v1.train.summary_iterator
Возвращает итератор для чтения Event протоколов из файла событий.
tf.compat.v1.train.summary_iterator(
path
)
Вы можете использовать эту функцию для чтения событий, записанных в файл событий. Она возвращает итератор Python, который возвращает Event протоколы.
Пример: Вывод содержимого файла событий.
for e in tf.compat.v1.train.summary_iterator(path to events file):
print(e)
Пример: Вывод выбранных значений сводки.
# 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(v.simple_value)
Пример: Непрерывный поиск новых значений сводки.
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(v.simple_value)
# Wait for a bit before checking the file for any new events
time.sleep(wait time)
См. определения протоколов Event и Summary для получения дополнительной информации об их атрибутах.
| Аргументы | |
|---|---|
path | Путь к файлу событий, созданному SummaryWriter. |
| Возвращает | |
|---|---|
Итератор, который возвращает Event протоколы |
© 2020 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/versions/r2.4/api_docs/python/tf/compat/v1/train/summary_iterator