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(tf.make_ndarray(v.tensor))
Пример: непрерывно проверять наличие новых значений сводки.
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)
Дополнительные сведения об атрибутах см. в определениях буферов протокола Event и Summary.
| Аргументы | |
|---|---|
path | Путь к файлу событий, созданному с помощью SummaryWriter. |
| Возвращает | |
|---|---|
Итератор, генерирующий буферы протокола Event |
© 2022 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 4.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/api_docs/python/tf/compat/v1/train/summary_iterator