返回用於從事件文件中讀取 Event
協議緩衝區的迭代器。
用法
tf.compat.v1.train.summary_iterator(
path
)
參數
-
path
SummaryWriter
創建的事件文件的路徑。
返回
-
產生
Event
協議緩衝區的迭代器
您可以使用此函數讀取寫入事件文件的事件。它返回一個 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 的協議緩衝區定義。
相關用法
- Python tf.compat.v1.train.shuffle_batch用法及代碼示例
- Python tf.compat.v1.train.FtrlOptimizer.compute_gradients用法及代碼示例
- Python tf.compat.v1.train.get_or_create_global_step用法及代碼示例
- Python tf.compat.v1.train.cosine_decay_restarts用法及代碼示例
- Python tf.compat.v1.train.Optimizer用法及代碼示例
- Python tf.compat.v1.train.AdagradOptimizer.compute_gradients用法及代碼示例
- Python tf.compat.v1.train.init_from_checkpoint用法及代碼示例
- Python tf.compat.v1.train.Checkpoint用法及代碼示例
- Python tf.compat.v1.train.Supervisor.managed_session用法及代碼示例
- Python tf.compat.v1.train.Checkpoint.restore用法及代碼示例
- Python tf.compat.v1.train.global_step用法及代碼示例
- Python tf.compat.v1.train.MonitoredSession.run_step_fn用法及代碼示例
- Python tf.compat.v1.train.RMSPropOptimizer.compute_gradients用法及代碼示例
- Python tf.compat.v1.train.exponential_decay用法及代碼示例
- Python tf.compat.v1.train.natural_exp_decay用法及代碼示例
- Python tf.compat.v1.train.MomentumOptimizer用法及代碼示例
- Python tf.compat.v1.train.RMSPropOptimizer用法及代碼示例
- Python tf.compat.v1.train.get_global_step用法及代碼示例
- Python tf.compat.v1.train.GradientDescentOptimizer.compute_gradients用法及代碼示例
- Python tf.compat.v1.train.linear_cosine_decay用法及代碼示例
注:本文由純淨天空篩選整理自tensorflow.org大神的英文原創作品 tf.compat.v1.train.summary_iterator。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。