Getting Started With TensorFlow
https://www.tensorflow.org/get_started/get_started
tf.contrib.learn是更高层的API,TensorFlow Core是底层API。
本文档讲底层。
node 只是一个节点,不直接计算。计算是在session里。
##The Computational Graph
###constant 常量
可以是数 list 等等
node1 = tf.constant([1, 2], tf.float32)
###placeholder
通过feed_dict传入
Variable
init = tf.global_variables_initializer()只是初始化Variables
可通过assign重新赋值
##tf.train API
线性回归,因为w和b是Variable,因此只要设定了优化器,使其最小化loss,就会自动执行BP反向传播(计算梯度,根据梯度更新w和b),重复若干epoch,每一次cpoch改变一次w和b,最终得到最优的w和b。
# optimizer
optimizer = tf.train.GradientDescentOptimizer(0.01)
train = optimizer.minimize(loss)
tf.contrib.learn
###Basic usage