官术网_书友最值得收藏!

TensorBoard

TensorBoard is TensorFlow's visualization tool that can be used to visualize the computational graph. It can also be used to plot various quantitative metrics and the results of several intermediate calculations. Using TensorBoard, we can easily visualize complex models, which will be useful for debugging and also sharing.

Now, let's build a basic computation graph and visualize that in TensorBoard.

First, let's import the library:

import tensorflow as tf

Next, we initialize the variables:

a = tf.constant(5)
b = tf.constant(4)
c = tf.multiply(a,b)
d = tf.constant(2)
e = tf.constant(3)
f = tf.multiply(d,e)
g = tf.add(c,f)

Now, we will create a TensorFlow session. We will write the results of our graph to a file called event using tf.summary.FileWriter():

with tf.Session() as sess:
writer = tf.summary.FileWriter("output", sess.graph)
print(sess.run(g))
writer.close()

In order to run the TensorBoard, go to your Terminal, locate the working directory, and type tensorboard --logdir=output --port=6003.

You can see the output as shown next:

主站蜘蛛池模板: 昭苏县| 长治市| 扎鲁特旗| 双鸭山市| 闵行区| 宜良县| 溧阳市| 宝丰县| 阳西县| 渝中区| 肥乡县| 枣庄市| 电白县| 墨玉县| 报价| 准格尔旗| 临沂市| 黎平县| 张家口市| 新化县| 星子县| 邵阳县| 新津县| 益阳市| 张家港市| 正宁县| 曲靖市| 郸城县| 嘉祥县| 任丘市| 如皋市| 六枝特区| 东海县| 兴和县| 沙湾县| 吉安县| 安阳市| 桦川县| 密云县| 禹城市| 湄潭县|