tf.keras.initializers.GlorotUniform

The Glorot uniform initializer, also called Xavier uniform initializer.

Inherits From: VarianceScaling, Initializer

Also available via the shortcut function tf.keras.initializers.glorot_uniform.

Draws samples from a uniform distribution within [-limit, limit], where limit = sqrt(6 / (fan_in + fan_out)) (fan_in is the number of input units in the weight tensor and fan_out is the number of output units).

Examples:

# Standalone usage:
initializer = tf.keras.initializers.GlorotUniform()
values = initializer(shape=(2, 2))
# Usage in a Keras layer:
initializer = tf.keras.initializers.GlorotUniform()
layer = tf.keras.layers.Dense(3, kernel_initializer=initializer)

seed A Python integer. An initializer created with a given seed will always produce the same random tensor for a given shape and dtype.

References:

Glorot et al., 2010 (pdf)

Methods

from_config

View source

Instantiates an initializer from a configuration dictionary.

Example:

initializer = RandomUniform(-1, 1)
config = initializer.get_config()
initializer = RandomUniform.from_config(config)

Args
config A Python dictionary, the output of