<Depth learning> TensorBoard the demo

import tensorflow.compat.v1 as tf

import os

os.environ["CUDA_VISIBLE_DEVICES"] = "-1"
tf.disable_v2_behavior()
a = tf.constant(4, name = "input_a")
b = tf.constant(2, name = "input_b")
c = tf.multiply(a, b, name = "mul_c")
d = tf.add(a, b, name = "add_d")
e = tf.add(c, d, name = "add_e")

sess = tf.Session()
print(sess.run(e))
write = tf.summary.FileWriter('./my_graph/1', sess.graph)

 

Run under the current folder found more than a my_graph, which has a 1 folder, which has 1 log data

 

This file is opened with TensorBoard

 

Run TensorBoard method:

 

Save the log into the file, run the statement: tensorboard --logdir = the Data (the Data is a full directory to save the log files)
is successful, the bottom will show an address, usually http: // localhost: 6006 /

Copy into your browser open, you can see the data flow graph friends

Guess you like

Origin www.cnblogs.com/painKiller/p/12068796.html