I just installed tensorflow 1.2.1 in the past few days and found a tensoflow textbook, but the version is not 1.2.1 but a lower version. Recommended (Tensorflow practice for machine intelligence) I personally feel good.
This book talks about how to open the graph, but I can't open it no matter how I press it. Later, I stepped on a lot of pits and finally opened it.
First, it is recommended to use Google's chrome browser . I use 360 and IE to open both whiteboards. I can open them with chrome, but there is no display in the graph module.
Second, the syntax problem, the Tensorflow version in the book is not 1.2.1, so there is a little difference, such as creating a node for multiplication,
The syntax in the book is c = tf.mul(a, b, name="mul_c"), but in version 1.2.1 it is c = tf.multiply(a, b, name="mul_c")
The most important thing is the sentence summarywriter. The book is writer = tf.train.SummaryWriter('./my_graph', sess.graph). When I typed the code, it was prompted that there was no SummaryWriter function, and then all kinds of Baidu.
Finally, I combined the writing method of others on the Internet and changed it to: merged = tf.summary.merge_all()
writer = tf.summary.FileWriter('tmp', sess.graph)
Third, the path problem (tmp is a folder created by me, and the py file is in the same path), when the code is executed, a file will be generated in the temp folder.
Then WIN+R open cmd to enter the path where the tmp folder is located , and then enter the command tensorboard --logdir= tmp
Note: Do not press CTRL+C or close it directly, if you exit or close it will not open.
Then copy and paste the URL into the chrome browser, click graph to see the flow chart.
Finally, paste your own scum code for testing by those who need it. This code is based on version 1.2.1 of tensorflow
import tensorflow as tf a = tf.constant(5, name="input_a") b = tf.constant(3, 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") sex = tf.Session () # sess.run output = sess.run(e) merged = tf.summary.merge_all() writer = tf.summary.FileWriter('tmp', sess.graph) writer.close() sess.close()