Skip to content

Commit

Permalink
Merge pull request chainer#5660 from toslunar/doc-ndarray
Browse files Browse the repository at this point in the history
Add documentation of `ndarray`
  • Loading branch information
okuta committed Nov 25, 2018
1 parent 0f0d195 commit eb0562a
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 4 deletions.
3 changes: 1 addition & 2 deletions chainer/functions/activation/clipped_relu.py
Expand Up @@ -129,8 +129,7 @@ def clipped_relu(x, z=20.0):
.. math:: \\text{ClippedReLU}(x, z) = \\min(\\max(0, x), z).
Args:
x (:class:`~chainer.Variable` or :class:`numpy.ndarray` or \
:class:`cupy.ndarray`):
x (:class:`~chainer.Variable` or :ref:`ndarray`):
Input variable. A :math:`(s_1, s_2, ..., s_n)`-shaped float array.
z (float): Clipping value. (default = 20.0)
Expand Down
4 changes: 3 additions & 1 deletion docs/source/reference/functions.rst
Expand Up @@ -4,7 +4,9 @@ Functions
.. module:: chainer.functions

Chainer provides variety of built-in function implementations in :mod:`chainer.functions` package.
These functions return a :class:`~chainer.Variable` object or a tuple of multiple :class:`~chainer.Variable` objects.
These functions usually return a :class:`~chainer.Variable` object or a tuple of multiple :class:`~chainer.Variable` objects.
For a :class:`~chainer.Variable` argument of a function, an :ref:`ndarray` can be passed if you do not need its gradient.
Some functions additionally supports scalar arguments.

.. note::
Functions implemented in Chainer consists of the following two parts:
Expand Down
21 changes: 20 additions & 1 deletion docs/source/reference/variable.rst
@@ -1,5 +1,8 @@
Variable and Parameter
----------------------
======================

Variable classes and utilities
------------------------------

.. autosummary::
:toctree: generated/
Expand All @@ -9,3 +12,19 @@ Variable and Parameter
chainer.as_variable
chainer.Parameter
chainer.variable.VariableNode


.. _ndarray:

N-dimensional array
-------------------

:class:`chainer.Variable` holds its value as an n-dimensional array (ndarray).
Chainer supports the following classes:

* :class:`numpy.ndarray`, including :class:`ideep4py.mdarray`
* :class:`cupy.ndarray`

.. note::
Python scalars (:class:`float`, etc.) and NumPy scalars (``numpy.float16``, ``numpy.float32``, etc.) cannot be used as :attr:`chainer.Variable.array`.
See also :func:`chainer.utils.force_array`.

0 comments on commit eb0562a

Please sign in to comment.