def save_scalar(step, name, value, writer):
"""Save a scalar value to tensorboard.
Parameters
----------
step: int
Training step (sets the position on x-axis of tensorboard graph.
name: str
Name of variable. Will be the name of the graph in tensorboard.
value: float
The value of the variable at this step.
writer: tf.FileWriter
The tensorboard FileWriter instance.
"""
summary = tf.Summary()
summary_value = summary.value.add()
summary_value.simple_value = float(value)
summary_value.tag = name
writer.add_summary(summary, step)
评论列表
文章目录