tf.contrib.layers.variance_scaling_initializer
Stay organized with collections
Save and categorize content based on your preferences.
Returns an initializer that generates tensors without scaling variance.
tf.contrib.layers.variance_scaling_initializer(
factor=2.0, mode='FAN_IN', uniform=False, seed=None, dtype=tf.dtypes.float32
)
When initializing a deep network, it is in principle advantageous to keep
the scale of the input variance constant, so it does not explode or diminish
by reaching the final layer. This initializer use the following formula:
if mode='FAN_IN': # Count only number of input connections.
n = fan_in
elif mode='FAN_OUT': # Count only number of output connections.
n = fan_out
elif mode='FAN_AVG': # Average number of inputs and output connections.
n = (fan_in + fan_out)/2.0
truncated_normal(shape, 0.0, stddev=sqrt(factor / n))
Args |
factor
|
Float. A multiplicative factor.
|
mode
|
String. 'FAN_IN', 'FAN_OUT', 'FAN_AVG'.
|
uniform
|
Whether to use uniform or normal distributed random initialization.
|
seed
|
A Python integer. Used to create random seeds. See
tf.compat.v1.set_random_seed for behavior.
|
dtype
|
The data type. Only floating point types are supported.
|
Returns |
An initializer that generates tensors with unit variance.
|
Raises |
ValueError
|
if dtype is not a floating point type.
|
TypeError
|
if mode is not in ['FAN_IN', 'FAN_OUT', 'FAN_AVG'].
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2020-10-01 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2020-10-01 UTC."],[],[]]