Friday, February 17, 2017


On 2017.2.16 at Dev Summit 2007, TensorFlow 1.0 is announced! It has been 15 months since it was open sourced.
Tensorflow is also working on high-level APIs for better user experience. tf.layersis already available but without further detail of how to train.
tf.keras will be available around TensorFlow 1.2.
I love what Lily Peng said about the career-changing:
In a previous life I was a doctor, and I’ve been repurposed as a product manager at google.

how to use Tensorboard

In Dev Summit, Dandelion demonstrated the magic of TensorBoard. The highlighted codes in the slides are very impressive. video, source code and slides
The use of tensorboard is actually 2 steps:
  1. use a tf.summary.FileWriter(folder_name) object to add everything you want to show, which will be stored in a folder in lcoal disk.
  2. In terminal, tensorboard --logdir=folder_name which will output data to something like “”. Open it in a browser.
So the major work in 1st step. Example code is here.
Several tricks:
  1. use with tf.name_scope() to name a group of tensors or operations.
  2. use name= to name a single tensor
  3. use writer = tf.summary.FileWriter( folder_name)to create writer
  4. use writer.add_graph(sess.graph) to add graph. Note: if you revise the graph, remember to reset it to avoid ghost graph.
  5. use writer.add_summary(scalar/histogram/image tensor,step) to add a point for the plotting data. Each tensor will be wrapped by tf.summary.scalar/histogram/image and evaluated at step.
  6. tf.summary.merge_all() is supposed to simplified the previous codes. but it is currently buggy.
  7. model saving/restoring is 2 lines of code:
    saver = tf.train.Saver()
    saver.restore(sess, "mymodel.ckpt") # after session begin, "mymodel.ckpt") # before session ends
similarly, you can save/restore dataset in 2 lines of code
   from sklearn.externals import joblib
   joblib.dump(data, 'dataset.pkl') 
   data = joblib.load('dataset.pkl')