Skip to content

Commit

Permalink
Merge pull request #3327 from niboshi/doc-initializer
Browse files Browse the repository at this point in the history
Document initializer criteria
  • Loading branch information
delta2323 committed Nov 6, 2017
2 parents 0772aaa + 33a5692 commit bdebb7d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 12 deletions.
13 changes: 5 additions & 8 deletions chainer/links/connection/linear.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,11 @@ class Linear(link.Link):
data pass at which time the size will be determined.
out_size (int): Dimension of output vectors.
nobias (bool): If ``True``, then this function does not use the bias.
initialW (2-D array): Initial weight value. If ``None``, then the
default initializer is used.
May also be a callable that takes ``numpy.ndarray`` or
``cupy.ndarray`` and edits its value.
initial_bias (1-D array): Initial bias value. If ``None``, the bias
vector is initialized to zero.
May also be a callable that takes ``numpy.ndarray`` or
``cupy.ndarray`` and edits its value.
initialW (:ref:`initializer <initializer>`): Initializer to initialize
the weight.
initial_bias (:ref:`initializer <initializer>`): Initializer to
initialize the bias. If ``None``, the bias will be initialized to
zero.
.. seealso:: :func:`~chainer.functions.linear`
Attributes:
Expand Down
21 changes: 17 additions & 4 deletions docs/source/reference/initializers.rst
Original file line number Diff line number Diff line change
@@ -1,10 +1,23 @@
.. _initializer:

Weight Initializers
===================

Weight initializer is an instance of :class:`~chainer.Initializer` that
destructively edits the contents of :class:`numpy.ndarray` or :class:`cupy.ndarray`.
Typically, weight initializers are passed to ``__init__`` of :class:`~chainer.Link`
and initializes its the weights and biases.
Weight initializers are used to initialize arrays.
They destructively modify the content of :class:`numpy.ndarray`
or :class:`cupy.ndarray`.
Typically, weight initializers are passed to :class:`~chainer.Link`\ s
to initialize their weights and biases.

A weight initializer can be any of the following objects.

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

Base class
----------
Expand Down

0 comments on commit bdebb7d

Please sign in to comment.