Тензорная доска не была разработана для подобных сюжетов, поэтому это неудобно, но вы можете сделать что-то вроде этого:
import numpy as np
import tensorflow as tf
# Create '/tmp/activations' directory or point to some other directory
summary_writer = tf.summary.FileWriter(logdir='/tmp/activations')
x_numpy = np.linspace(start=-6.0, stop=6.0, num=120)
x = tf.constant(x_numpy)
y = tf.nn.sigmoid(x)
with tf.Session() as sess:
y_numpy = sess.run(y)
for x_i, y_i in zip(x_numpy, y_numpy):
# Create a tensorboard summary with sigmoid output as the value
# and sigmoid input as a step (which is normally
# the `global_step` tensor). Tensorboards plots step in x-axis.
# step must be an integer. So, we multiply x_i by 1M and convert
# it to int. This should be precise enough. In the plot,
# just ignore the "M" suffix.
value = tf.Summary.Value(tag='sigmoid', simple_value=y_i)
summary_writer.add_event(
event=tf.summary.Event(summary=tf.Summary(value=[value]),
step=int(1000000 * x_i)))
summary_writer.close()
# Point tensorboad to '/tmp/activations'