https://github.com/chainer/chainer
Raw File
Tip revision: 89b96616d29e2f00e34d16cb29ccbf5742b631cb authored by emcastillo on 21 June 2019, 06:03:45 UTC
Merge pull request #7572 from chainer/v7.0.0b1
Tip revision: 89b9661
_ndarray.py
# This file implements chainerx.ndarray methods that can be defined only in
# Python.

import chainerx


def populate():

    def clip(self, a_min, a_max):
        """Returns an array with values limited to [``a_min``, ``a_max``].

        .. seealso:: :func:`chainerx.clip` for full documentation,
            :meth:`numpy.ndarray.clip`

        """
        return chainerx.clip(self, a_min, a_max)

    def ravel(self):
        """Returns an array flattened into one dimension.

        .. seealso:: :func:`chainerx.ravel` for full documentation,
            :meth:`numpy.ndarray.ravel`

        """
        return chainerx.ravel(self)

    chainerx.ndarray.clip = clip
    chainerx.ndarray.ravel = ravel
back to top