chainer.initializers.generate_array¶
-
chainer.initializers.generate_array(initializer, shape, xp, dtype=None, device=None)[source]¶ Return initialized array.
The algorithms used to make the new values depend on the concrete derived classes. If the initializer has the
dtypeattribute, it is used to construct the array. Otherwise,chainer.config.dtypeis used instead. See Configuring Chainer for the dtype config.- Parameters
initializer – A callable object that takes
numpy.ndarrayorcupy.ndarrayand edits its value.shape (tuple) – Shape of a return array.
dtype – Dtype specifier. If omitted,
initializer.dtypeis used.device – Target device specifier. If omitted, the current device is used for
cupy, and the default device is used forchainerx.
- Returns
An initialized array.
- Return type
numpy.ndarray, cupy.ndarray, or chainerx.ndarray