def apply(self, x, batch_size=None, **kwargs):
        r"""
        Applies this transform to ``x``.

        If ``x`` is :map:`Transformable`, ``x`` will be handed this transform
        object to transform itself non-destructively (a transformed copy of the
        object will be returned).

        If not, ``x`` is assumed to be an `ndarray`. The transformation will be
        non-destructive, returning the transformed version.

        Any ``kwargs`` will be passed to the specific transform :meth:`_apply`
        method.

        Parameters
        ----------
        x : :map:`Transformable` or ``(n_points, n_dims)`` `ndarray`
            The array or object to be transformed.
        batch_size : `int`, optional
            If not ``None``, this determines how many items from the numpy
            array will be passed through the transform at a time. This is
            useful for operations that require large intermediate matrices
            to be computed.
        kwargs : `dict`
            Passed through to :meth:`_apply`.

        Returns
        -------
        transformed : ``type(x)``
            The transformed object or array
        """

        def transform(x_):
            """
            Local closure which calls the :meth:`_apply` method with the
            `kwargs` attached.
            """
            return self._apply_batched(x_, batch_size, **kwargs)

        try:
            return x._transform(transform)
        except __HOLE__:
            return self._apply_batched(x, batch_size, **kwargs)
dataset/ETHPy150Open menpo/menpo/menpo/transform/base/__init__.py/Transform.apply