Weight Initializers

Weight initializers are used to initialize arrays. They destructively modify the content of numpy.ndarray or cupy.ndarray. Typically, weight initializers are passed to Links to initialize their weights and biases.

A weight initializer can be any of the following objects.

  • chainer.Initializer class instance.
  • Python or NumPy scalar or numpy.ndarray.
  • A callable that takes an array (numpy.ndarray or cupy.ndarray) and feeds the initial data into it.
  • None, in which case the default initializer is used. Unless explicitly specified, it is LeCunNormal with scale value 1.

Base class

chainer.Initializer Initializes array.

Concrete initializers

chainer.initializers.Identity Initializes array with the identity matrix.
chainer.initializers.Constant Initializes array with constant value.
chainer.initializers.Zero Initializes array to all-zero.
chainer.initializers.One Initializes array to all-one.
chainer.initializers.NaN Initializes array to all-NaN.
chainer.initializers.Normal Initializes array with a normal distribution.
chainer.initializers.LeCunNormal Initializes array with scaled Gaussian distribution.
chainer.initializers.GlorotNormal Initializes array with scaled Gaussian distribution.
chainer.initializers.HeNormal Initializes array with scaled Gaussian distribution.
chainer.initializers.Orthogonal Initializes array with an orthogonal system.
chainer.initializers.Uniform Initializes array with a scaled uniform distribution.
chainer.initializers.LeCunUniform Initializes array with a scaled uniform distribution.
chainer.initializers.GlorotUniform Initializes array with a scaled uniform distribution.
chainer.initializers.HeUniform Initializes array with scaled uniform distribution.

Helper function

chainer.initializers.generate_array Return initialized array.