寫一個標量摘要。
用法
tf.summary.scalar(
name, data, step=None, description=None
)
參數
-
name
此摘要的名稱。用於 TensorBoard 的摘要標記將是此名稱,以任何活動名稱範圍為前綴。 -
data
一個實數值標量值,可轉換為float32
張量。 -
step
此摘要的顯式int64
-castable 單調步長 值。如果省略,則默認為tf.summary.experimental.get_step()
,不能為 None。 -
description
此摘要的可選長格式說明,作為常量str
。支持Markdown 。默認為空。
返回
- 成功時為真,如果沒有寫入摘要,則為假,因為沒有可用的默認摘要編寫器。
拋出
-
ValueError
如果存在默認編寫器,但未提供任何步驟且tf.summary.experimental.get_step()
為無。
另見tf.summary.image
、tf.summary.histogram
、tf.summary.SummaryWriter
。
為 TensorBoard 中的後續分析寫入簡單的數值。寫入到當前的默認摘要編寫器。每個匯總點都與一個整數 step
值相關聯。這啟用了時間序列數據的增量記錄。此 API 的常見用法是在訓練期間記錄損失以生成損失曲線。
例如:
test_summary_writer = tf.summary.create_file_writer('test/logdir')
with test_summary_writer.as_default():
tf.summary.scalar('loss', 0.345, step=1)
tf.summary.scalar('loss', 0.234, step=2)
tf.summary.scalar('loss', 0.123, step=3)
通過給每個係列一個唯一的name
值,可以記錄多個獨立的時間係列。
有關有效使用 tf.summary.scalar 的更多示例,請參閱 TensorBoard 入門。
通常,此 API 期望數據點以單調遞增的步長 值記錄。不能保證在 TensorBoard 中按需要顯示單個步驟的重複點或無序記錄的點。
相關用法
- Python tf.summary.text用法及代碼示例
- Python tf.summary.record_if用法及代碼示例
- Python tf.summary.experimental.summary_scope用法及代碼示例
- Python tf.summary.histogram用法及代碼示例
- Python tf.summary.SummaryWriter.as_default用法及代碼示例
- Python tf.summary.graph用法及代碼示例
- Python tf.summary.image用法及代碼示例
- Python tf.strings.substr用法及代碼示例
- Python tf.strings.reduce_join用法及代碼示例
- Python tf.sparse.cross用法及代碼示例
- Python tf.sparse.mask用法及代碼示例
- Python tf.strings.regex_full_match用法及代碼示例
- Python tf.sparse.split用法及代碼示例
- Python tf.strings.regex_replace用法及代碼示例
- Python tf.signal.overlap_and_add用法及代碼示例
- Python tf.strings.length用法及代碼示例
- Python tf.strided_slice用法及代碼示例
- Python tf.sparse.to_dense用法及代碼示例
- Python tf.strings.bytes_split用法及代碼示例
- Python tf.shape用法及代碼示例
注:本文由純淨天空篩選整理自tensorflow.org大神的英文原創作品 tf.summary.scalar。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。