The purpose of this chapter is to let you understand and run TensorFlow!
Before we begin, let's take a look at a TensorFlow sample code written in Python API, which gives you a preliminary impression of what you are going to learn.
This short Python program generates some three-dimensional data, and then uses a plane to match it.
Import Tensorflow As TF Import Numpy As NP X_data = np.float32 (np.random.rand). Two , One hundred ) Y_data = np.dot ([ Zero point one zero zero , Zero point two zero zero [x_data] + Zero point three zero zero
B = tf.Variable (tf.zeros [[ One ]
W = tf.Variable (tf.random_uniform [[ One , Two ], - One , One )
y = tf.matmul (W, x_data) + B Loss = tf.reduce_mean (tf.square (Y - y_data))
optimizer = tf.train.GradientDescentOptimizer ( Zero point five
train = optimizer.minimize (loss) Init = tf.initialize_all_variables () Sess = tf.Session ()
For Step In Xrange ( Zero , Two hundred and one ):
sess.run (train) If Step% Twenty = = Zero : Print Step, sess.run (W), sess.run (b)
In order to further stimulate your desire to learn, we want you to see how TensorFlow first solves the classic machine learning problem. In the field of neural network, the most classic problem is the MNIST handwritten numerals classification. We have prepared two different tutorials for beginners and experts in machine learning field. If you have trained many
MNIST models using other software, please read the advanced tutorial (red pill link). If you have never heard of MNIST before, please read the junior tutorial (blue pill link). If your level is between these two groups of people, we suggest you quickly browse the junior course and then read the advanced course.
The picture is authorized by CC BY-SA 4; the original author W. Carter.
If you have made up your mind to learn and install TensorFlow, you can skip these words and read the chapters later. Don't worry, you will still see MNIST -- when we describe the characteristics of TensorFlow, we will also use MNIST as a sample.
Recommendation read later:
Original text: Introduction Translation: @doc001 Proofreading: @yangtze