如何在 tensorflow 2.x 中水平排列 tensorboard 的图形?

How to arrange tensorboard's graphs horizontally in tensorflow 2.x?

我用的是下面的代码,画的是竖排的,怎么改成横排的?

with self.summary_writer.as_default():
    tf.summary.scalar("loss", self.loss[-1], step=self.steps)
    tf.summary.scalar("reward", self.rewards[-1], step=self.steps)
    tf.summary.scalar("average_rewards", np.nanmean(self.rewards[-1000:]), step=self.steps)

我在tensorflow首页没找到

https://www.tensorflow.org/api_docs/python/tf/summary/scalar

按照建议使用正则表达式here对齐您的图:

import tensorflow as tf

logdir = 'logs/func/'
writer = tf.summary.create_file_writer(logdir)
with writer.as_default():
    tf.summary.scalar("loss", 5, step=0)
    tf.summary.scalar("reward", 6, step=1)
    tf.summary.scalar("average_rewards", 7, step=2)

启动张量板:

%load_ext tensorboard
%tensorboard --logdir logs/func

<点击图片查看详情>