相关疑难解决方法(0)

如何在TensorFlow 2中写入TensorBoard

我对TensorFlow 1.x非常熟悉,并且正在考虑为即将进行的项目切换到TensorFlow 2。我在理解如何使用自定义训练循环,急切执行将标量写入TensorBoard日志时遇到一些麻烦。

问题描述

在tf1中,您将创建一些摘要操作(每个要存储的操作一个操作),然后将其合并为一个操作,在会话中运行合并的操作,然后使用FileWriter对象将其写入文件。假设sess是我们tf.Session(),下面是一个如何工作的示例:

# While defining our computation graph, define summary ops:
# ... some ops ...
tf.summary.scalar('scalar_1', scalar_1)
# ... some more ops ...
tf.summary.scalar('scalar_2', scalar_2)
# ... etc.

# Merge all these summaries into a single op:
merged = tf.summary.merge_all()

# Define a FileWriter (i.e. an object that writes summaries to files):
writer = tf.summary.FileWriter(log_dir, sess.graph)

# Inside the training loop run the op and write the …
Run Code Online (Sandbox Code Playgroud)

python machine-learning deep-learning keras tensorflow

6
推荐指数
1
解决办法
842
查看次数

Tensorboard-叠加2个图

在张量板中,我想在同一图表上叠加2个图(神经网络的训练和验证损失).

我可以看到2个单独的图,但不是一个有2条叠加曲线的图.否则,我得到一个曲折的情节.

我能怎么做?

neural-network tensorflow tensorboard

5
推荐指数
2
解决办法
1453
查看次数