Class He<T extends TFloating>

Type Parameters:
T - The TType for the call operation
All Implemented Interfaces:
Initializer<T>

public class He<T extends TFloating> extends VarianceScaling<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:
  • Field Details

  • Constructor Details

    • He

      public He(VarianceScaling.Distribution distribution, long seed)
      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: