W = tf.Variable(tf.random_uniform([1], -1.0, 1.0))
b = tf.Variable(tf.zeros([1]))
y = W * x_data + b
loss = tf.reduce_mean(tf.square(y - y_data))
optimizer = tf.train.GradientDescentOptimizer(0.5)
train = optimizer.minimize(loss)
init = tf.initialize_all_variables()
sess = tf.Session()
sess.run(init)
writer = tf.train.SummaryWriter('/tmp/test', sess.graph)
for step in range(201):
    sess.run(train)
if step % 20 == 0:
    pass
How to create a Tensorflow Tensorboard Empty Graph