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?
#initializer = tf.contrib.layers.xavier_initializer() initializer = tf.initializers.glorot_uniform() initializer = tf.initializers.GlorotNormal()
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