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

The input data layer

The input data on the graph represents each pair of two inputs computed at a time in this XOR model using FNN_XOR_Tensorflow.py.

This program shows how to build a TensorFlow network in a few lines. In other models, millions of pixels or other values can constitute the input. In this case, XOR is trained with this model:

XOR_X = [[0,0],[0,1],[1,0],[1,1]]

The first two inputs are (0,0), for example. The input will contain x1=0 and x2=0. Those inputs are sent to the hidden layer along with the weights and biases:

W1 = tf.Variable(tf.random_uniform([2,2], -1, 1), name = "Weights1")
B1 = tf.Variable(tf.zeros([2]), name = "Bias1")