Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to visualize a tensor summary in tensorboard

I'm trying to visualize a tensor summary in tensorboard. However I can't see the tensor summary at all in the board. Here is my code:

        out = tf.strided_slice(logits, begin=[self.args.uttWindowSize-1, 0], end=[-self.args.uttWindowSize+1, self.args.numClasses],
                               strides=[1, 1], name='softmax_truncated')
        tf.summary.tensor_summary('softmax_input', out)

where out is a multi-dimensional tensor. I guess there must be something wrong with my code. Probably I used the tensor_summary function incorrectly.

like image 709
Zhao Avatar asked Jan 16 '17 08:01

Zhao


People also ask

Can we check metadata of model in TensorBoard?

Overview. Using the TensorFlow Text Summary API, you can easily log arbitrary text and view it in TensorBoard. This can be extremely helpful to sample and examine your input data, or to record execution metadata or generated text.


1 Answers

What you do is you create a summary op, but you don't invoke it and don't write the summary (see documentation). To actually create a summary you need to do the following:

# Create a summary operation
summary_op = tf.summary.tensor_summary('softmax_input', out)

# Create the summary
summary_str = sess.run(summary_op)

# Create a summary writer
writer = tf.train.SummaryWriter(...)

# Write the summary
writer.add_summary(summary_str)

Explicitly writing a summary (last two lines) is only necessary if you don't have a higher level helper like a Supervisor. Otherwise you invoke

sv.summary_computed(sess, summary_str)

and the Supervisor will handle it.

More info, also see: How to manually create a tf.Summary()

like image 134
Michael Gygli Avatar answered Oct 06 '22 22:10

Michael Gygli