chainer.initializers.generate_array(initializer, shape, xp, dtype=None)[source]

Return initialized array.

The algorithms used to make the new values depend on the concrete derived classes. If the initializer has the dtype attribute, it is used to construct the array. Otherwise, chainer.config.dtype is used instead. See Configuring Chainer for the dtype config.

  • initializer – A callable object that takes N-dimensional array and edits its value.
  • shape (tuple) – Shape of a return array.
  • xp (module) – cupy or numpy.
  • dtype – Dtype specifier. If omitted, initializer.dtype is used.

An initialized array.

Return type:

N-dimensional array