How to visualize tensor summary in tensocardboard

I am trying to present a tensor summary in a tensor. However, I do not see the tensor summary on the board at all. 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 the multidimensional tensor. I think there should be something wrong with my code. I probably misused the tensor_summary function.

+5
source share
2 answers

What you are doing is creating a summary op operator, but you don't call it or write a resume (see the documentation ). To create a bulletin, 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) 

An explicit summary entry (the last two lines) is only necessary if you do not have a higher-level helper, such as Supervisor , otherwise you call

 sv.summary_computed(sess, summary_str) 

and Supervisor will process it.

See also: How to manually create tf.Summary ()

+1
source

Not sure if this is obvious, but you can use something like

 def make_tensor_summary(tensor, name='defaultTensorName'): for i in range(tensor.get_shape()[0]: for j in range(tensor.get_shape()[1]: tf.summary.scalar(Name + str(i) + '_' + str(j), tensor[i, j]) 

if you know that this is a "matrix" tensor in advance.

0
source

Source: https://habr.com/ru/post/1262860/


All Articles