Reference: https://www.tensorflow.org/get_started/get_started
1. Multiple level APIs:
(1) lowest level: TensorFlow Core, if you need fine controls on the model
(2) higher levels: built on Core, easier to use, e.g. tf.contrib.learn
2. Tensor: an array of primitive values. Rank: how many dimensions. Shape: a vector, containing the numbers of elements in each dimension.
e.g. [[[1., 2., 3.]], [[7., 8., 9.]]] has rank 3, shape [2,1,3]
3. Import library
import tensorflow as tf
4. computational graph: a graph of nodes, each node has 0 or more tensors as inputs and 1 tensor as output
5. session: contains the control and state of TensorFlow runtime
e.g.
sess = tf.Session(); sess.run([node1, node2])
6. Combine Tensor nodes and operations (also nodes), e.g.
node3 = tf.add(node1, node2)
7. Use TensorBoard to draw computational graph
8. Placeholder: like a parameter or variable, used to define a function
9. Variable: constructed with a type and initial value, used to add trainable parameters
10. loss function: measure the distance from model to ground truth
11. optimizer: change each variable to minimize loss. e.g. gradient descent
optimizer = tf.train.GradientDescentOptimizer(0.01)
12. estimator: front end to invoke training and evaluation,e.g. to do linear regression
estimator = tf.contrib.learn.LinearRegressor(feature_columns=features)
13. Use tf.contrib.learn.Estimator to define custom model