# brief introduction

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 NumPy uses phony to generate pseudo data (data data). X_data = np.float32 (np.random.rand). Two , One hundred ) Random input Y_data = np.dot ([ Zero point one zero zero , Zero point two zero zero [x_data] + Zero point three zero zero

A linear model for the construction of Chinese oak
Wei B = tf.Variable (tf.zeros [[ One ]
W = tf.Variable (tf.random_uniform [[ One , Two ], - One , One )
y = tf.matmul (W, x_data) + B Minimization of variance Loss = tf.reduce_mean (tf.square (Y - y_data))
optimizer = tf.train.GradientDescentOptimizer ( Zero point five
train = optimizer.minimize (loss) Initialization variable Init = tf.initialize_all_variables () Graph diagram Sess = tf.Session ()
sess.run (init) Fit plane
For Step In Xrange ( Zero , Two hundred and one ):
sess.run (train) If Step% Twenty = = Zero : Print Step, sess.run (W), sess.run (b) The best fitting result is W: [[0.100 0.200]], b: [0.300].
``````