I am trying to convert xavier initializer in a tensorflow code to glorot initializer.
I am not sure which one of the following (or other options) is correct?
JavaScript
x
4
1
#initializer = tf.contrib.layers.xavier_initializer()
2
initializer = tf.initializers.glorot_uniform()
3
initializer = tf.initializers.GlorotNormal()
4
Advertisement
Answer
Based on the code for xavier_initializer
, the default is uniform=True
which suggests glorot_uniform
may be what you want.
If you are using tf2, you may use tf.keras.initializers.GlorotUniform()
. tf.keras.initializers.glorot_uniform
is just a shortcut function for it: https://www.tensorflow.org/api_docs/python/tf/keras/initializers/GlorotUniform