He initializer.
If the distribution is TRUNCATED_NORMAL, it draws samples from a truncated normal distribution
centered on 0
with stddev = sqrt(2 / fanIn)
where fanIn
is
the number of input units in the weight tensor.
If the distribution is UNIFORM, it draws samples from a uniform distribution within
[-limit, limit]
, where limit = sqrt(6 / fanIn)
(fanIn is the number of input
units in the weight tensor).
Examples:
He Normal:
long seed = 1001l; He<TFloat32, TFloat32> initializer = new org.tensorflow.framework.initializers.He<>(tf, Distribution.TRUNCATED_NORMAL, seed);); Operand<TFloat32> values = initializer.call(tf.constant(Shape.of(2,2)), TFloat32.class);
He Uniform:
long seed = 1001l; He<TFloat32, TFloat32> initializer = new org.tensorflow.framework.initializers.He<>(tf, Distribution.UNIFORM, seed);); Operand<TFloat32> values = initializer.call(tf.constant(Shape.of(2,2)), TFloat32.class);
NOTE:
For an HeNormal equivalent initializer, use TRUNCATED_NORMAL
for the distribution parameter.
For an HeUniform equivalent initializer, use UNIFORM
for the distribution parameter.
Constants
double | SCALE |
Inherited Constants
Inherited Fields
Public Constructors
Inherited Methods
Constants
public static final double SCALE
Public Constructors
public He (Ops tf, VarianceScaling.Distribution distribution, long seed)
Creates an He Initializer
Parameters
tf | the TensorFlow Ops |
---|---|
distribution | The distribution type for the He initializer. |
seed | the seed for random number generation. An initializer created with a given seed will always produce the same random tensor for a given shape and dtype. |