Class He<T extends TFloating>
java.lang.Object
org.tensorflow.framework.initializers.BaseInitializer<T>
org.tensorflow.framework.initializers.VarianceScaling<T>
org.tensorflow.framework.initializers.He<T>
- Type Parameters:
T- The TType for the call operation
- All Implemented Interfaces:
Initializer<T>
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(Ops tf, 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(Ops tf, tf.constant(Shape.of(2,2)), TFloat32.class);
NOTE:
For an HeNormal equivalent initializer, use VarianceScaling.Distribution.TRUNCATED_NORMAL for the distribution parameter.
For an HeUniform equivalent initializer, use VarianceScaling.Distribution.UNIFORM for
the distribution parameter.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class VarianceScaling
VarianceScaling.Distribution, VarianceScaling.Mode -
Field Summary
FieldsFields inherited from class VarianceScaling
DISTRIBUTION_DEFAULT, MODE_DEFAULT, SCALE_DEFAULT -
Constructor Summary
ConstructorsConstructorDescriptionHe(VarianceScaling.Distribution distribution, long seed) Creates an He Initializer -
Method Summary
Methods inherited from class VarianceScaling
callMethods inherited from class BaseInitializer
getName
-
Field Details
-
SCALE
public static final double SCALE- See Also:
-
-
Constructor Details
-
He
Creates an He Initializer- Parameters:
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.- See Also:
-