TensorFlow is currently a very popular deeplearning framework, and the best way to learn TensorFlow is the TF project on GitHub Https://github.com/tensorflow/tensorflow
Or read the http://wiki.jikexueyuan.com/project/tensorflow-zh/how_tos/reading_data.html in the Chinese course of the geek's college-led translation.
Here to TensorFlow Basic grammar not to repeat, directly affixed to the source:
ImportNumPy as NPImportTensorFlow as TF
#准备数据trainX= Np.linspace (-1, 1, 101) Trainy= 2 * Trainx + NP.RANDOM.RANDN (*trainx.shape) * 0.33
#定义模型
defmodel (X, W):returnTf.mul (X, W)
#初始化数据流图X= Tf.placeholder ('float') Y= Tf.placeholder ('float') W= TF. Variable (0.0, name ='Weights') Y_=Model (X, W)
#评估模型cost= Tf.square (Y-y_) Train_op= Tf.train.GradientDescentOptimizer (0.01). Minimize (cost) Sess=TF. InteractiveSession () Init=tf.initialize_all_variables () #训练sess. Run (init) forIinchRange (100): for(x, Y)inchZip (Trainx, trainy): Sess.run (Train_op, Feed_dict={x:x, y:y})PrintSess.run (W) sess.close ()
TensorFlow (1)----linear_regression implementation