TensorBoard does not show scalars

Viewed 3401

I am playing TensorBoard and cannot make a simple example work. The computation is simply adding two constants.

import tensorflow as tf

sess = tf.Session()

a = tf.constant(1, name = "const1")
b = tf.constant(10, name = "const2")
c = a + b

asum = tf.summary.scalar("g1" , a)
bsum = tf.summary.scalar("g2",  b)
csum = tf.summary.scalar("gsum", c)

merged = tf.summary.merge_all()


train_writer = tf.summary.FileWriter('.\logs',sess.graph)

summary, _ = sess.run([merged, c])

train_writer.add_summary(summary, 0)

Then I compiled it first:

>python filename.py

everything looks good.

Then :

>tensorboard --logdir=".\logs" --inspect

The weird thing occurred: there were no scalars!

Found event files in:
.\logs

These tags are in .\logs:
audio -
histograms -
images -
scalars -
tensor -
======================================================================

Event statistics for .\logs:
audio -
graph
   first_step           0
   last_step            0
   max_step             0
   min_step             0
   num_steps            1
   outoforder_steps     []
histograms -
images -
scalars -
sessionlog:checkpoint -
sessionlog:start -
sessionlog:stop -
tensor -
======================================================================

Version of TensorFlow is: 1.2.1

Python version: 3.5.2

2 Answers

Changing the order of the sess.run worked for me when I faced the exact same issue.

_, summary = sess.run([c, merged])
Related