Open Gu-Youngfeng opened 5 years ago
The recommended answer is to use the Tensorboard.
create the log file of your model.
# import package
from tf.summary import FileWriter
# create the log file
writer = FileWriter("vis_log/", sess.graph)
writer.close()
use the following command to open the Tensorboard service on your computer.
> tensorboard --logdir=path/to/your/log-file
open the website localhost:6006
on your browser to see this framework.
I give a brief example of 2 layers network,
def try_graph_2():
x = tf.constant([[3.0, 4.0]])
weight_0 = tf.Variable(tf.random_normal(shape=(2,5), mean=0, stddev=1), name="weight_0")
weight_1 = tf.Variable(tf.random_uniform(shape=(5,1), minval=0, maxval=1), name="weight_1")
biase_0 = tf.Variable(tf.random_normal(shape=(1,5), mean=0, stddev=1), "biase_0")
biase_1 = tf.Variable(tf.random_uniform(shape=(1,1), minval=0, maxval=1), name="biase_1")
layer_1 = tf.matmul(x, weight_0) + biase_0
output = tf.matmul(layer_1, weight_1) + biase_1
# variables initialization
init = tf.global_variables_initializer()
# open a session
with tf.Session() as sess:
sess.run(init)
writer = tf.summary.FileWriter("vis_log/", sess.graph)
writer.close()
the corresponding graph is like this,
How to visualize the model we built in Tensorflow, I need the quickest and simplest way.