Initializer docstrings improvements (code formatting, etc).

PiperOrigin-RevId: 304261450
Change-Id: I293e815771434a67a57b276b9fdecb8b53a427ae
This commit is contained in:
Francois Chollet 2020-04-01 14:21:34 -07:00 committed by TensorFlower Gardener
parent e9f0ae16bf
commit 93fd484c16

View File

@ -353,15 +353,15 @@ class VarianceScaling(init_ops_v2.VarianceScaling, Initializer):
With `distribution="truncated_normal" or "untruncated_normal"`, samples are With `distribution="truncated_normal" or "untruncated_normal"`, samples are
drawn from a truncated/untruncated normal distribution with a mean of zero and drawn from a truncated/untruncated normal distribution with a mean of zero and
a standard deviation (after truncation, if used) `stddev = sqrt(scale / n)` a standard deviation (after truncation, if used) `stddev = sqrt(scale / n)`,
where n is: where `n` is:
- number of input units in the weight tensor, if mode = "fan_in" - number of input units in the weight tensor, if `mode="fan_in"`
- number of output units, if mode = "fan_out" - number of output units, if `mode="fan_out"`
- average of the numbers of input and output units, if mode = "fan_avg" - average of the numbers of input and output units, if `mode="fan_avg"`
With `distribution="uniform"`, samples are drawn from a uniform distribution With `distribution="uniform"`, samples are drawn from a uniform distribution
within [-limit, limit], with `limit = sqrt(3 * scale / n)`. within `[-limit, limit]`, where `limit = sqrt(3 * scale / n)`.
Examples: Examples:
@ -495,10 +495,9 @@ class GlorotUniform(VarianceScaling):
Also available via the shortcut function Also available via the shortcut function
`tf.keras.initializers.glorot_uniform`. `tf.keras.initializers.glorot_uniform`.
Draws samples from a uniform distribution within [-limit, limit] where `limit` Draws samples from a uniform distribution within `[-limit, limit]`, where
is `sqrt(6 / (fan_in + fan_out))` where `fan_in` is the number of input units `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 in the weight in the weight tensor and `fan_out` is the number of output units).
tensor.
Examples: Examples:
@ -631,9 +630,9 @@ class LecunUniform(VarianceScaling):
Also available via the shortcut function Also available via the shortcut function
`tf.keras.initializers.lecun_uniform`. `tf.keras.initializers.lecun_uniform`.
Draws samples from a uniform distribution within [-limit, limit] where `limit` Draws samples from a uniform distribution within `[-limit, limit]`,
is `sqrt(3 / fan_in)` where `fan_in` is the number of input units in the where `limit = sqrt(3 / fan_in)` (`fan_in` is the number of input units in the
weight tensor. weight tensor).
Examples: Examples:
@ -714,9 +713,9 @@ class HeUniform(VarianceScaling):
Also available via the shortcut function Also available via the shortcut function
`tf.keras.initializers.he_uniform`. `tf.keras.initializers.he_uniform`.
Draws samples from a uniform distribution within [-limit, limit] where `limit` Draws samples from a uniform distribution within `[-limit, limit]`, where
is `sqrt(6 / fan_in)` where `fan_in` is the number of input units in the `limit = sqrt(6 / fan_in)` (`fan_in` is the number of input units in the
weight tensor. weight tensor).
Examples: Examples: