How to do Xavier initialization on TensorFlow

Alejandro picture Alejandro · Nov 10, 2015 · Viewed 96.7k times · Source

I'm porting my Caffe network over to TensorFlow but it doesn't seem to have xavier initialization. I'm using truncated_normal but this seems to be making it a lot harder to train.

Answer

Sung Kim picture Sung Kim · Apr 22, 2016

Since version 0.8 there is a Xavier initializer, see here for the docs.

You can use something like this:

W = tf.get_variable("W", shape=[784, 256],
           initializer=tf.contrib.layers.xavier_initializer())