I am using the following code, the drawing is arranged vertically, how to change it to horizontal arrangement?
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)
I didn’t find it in the homepage of tensorflow.
https://www.tensorflow.org/api_docs/python/tf/summary/scalar
Advertisement
Answer
Use regex expressions as suggested here to align your plots:
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)
Start tensorboard:
%load_ext tensorboard %tensorboard --logdir logs/func