with tf.Session() as sess:
sess.run(tf.global_variables_initializer())
writer = tf.summary.FileWriter("E://TensorBoard//test", sess.graph).close()
# 也可以使用g = tf.get_default_graph(), 这样可以不运行会话得到结果
然后在命令行窗口输入
tensorboard --logdir=E://TensorBoard//test
然后前往 localhost:6006 查看即可