Artificial Intelligence By Example
上QQ阅读APP看书,第一时间看更新

The architecture of Python TensorFlow

Implementation of the McCulloch-Pitts neuron can best be viewed with TensorBoard, as shown in the following graph:

This is obtained by adding the following TensorBoard code at the end of your session. This data flow graph will help optimize a program when things go wrong.

#___________Tensorboard________________________

#with tf.Session() as sess:

Writer = tf.summary.FileWriter("directory on your machine", tfs.graph)
Writer.close()


def launchTensorBoard():
import os
#os.system('tensorboard --logdir=' + 'your directory')
os.system('tensorboard --logdir=' + 'your directory')
return

import threading
t = threading.Thread(target=launchTensorBoard, args=([]))
t.start()

tfs.close()
#Open your browser and go to http://localhost:6006
#Try the various options. It is a very useful tool.
#close the system window when your finished.

When you open the URL indicated in the code on your machine, you will see the following TensorBoard data flow graph: