chainer.initializers.generate_array

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

Return initialized array.

The algorithms used to make the new values depend on the concrete derived classes. The dtype of a generated array depends on initializer.dtype.

Parameters:
  • initializer – A callable object that takes numpy.ndarray or cupy.ndarray and edits its value.
  • shape (tuple) – Shape of a return array.
  • xp (module) – cupy or numpy.
Returns:

An initialized array.

Return type:

numpy.ndarray or cupy.ndarray