code: def permutate(x, indices, axis=0, inv=False):
      """Permutates a given variable along an axis.
  
      This function permutate ``x`` with given ``indices``.
      That means ``y[i] = x[indices[i]]`` for all ``i``.
      Note that this result is same as ``y = x.take(indices)``.
      ``indices`` must be a permutation of ``[0, 1, ..., len(x) - 1]``.
  
      When ``inv`` is ``True``, ``indices`` is treated as its inverse.
      That means ``y[indices[i]] = x[i]``.
  
      Args:
          x (:class:`~chainer.Variable` or :ref:`ndarray`):
              Variable to permutate.
              A :math:`(s_1, s_2, ..., s_N)` -shaped float array.
          indices (:class:`~chainer.Variable` or :ref:`ndarray`):
              Indices to extract from the variable. A one-dimensional int array.
          axis (int): Axis that the input array is permutate along.
          inv (bool): If ``True``, ``indices`` is treated as its inverse.
  
      Returns:
          ~chainer.Variable: Output variable.
  
      .. admonition:: Example
  
          >>> x = np.arange(6).reshape((3, 2)).astype(np.float32)
          >>> x
          array([[0., 1.],
                 [2., 3.],
                 [4., 5.]], dtype=float32)
          >>> indices = np.array([2, 0, 1], np.int32)
          >>> y = F.permutate(x, indices)
          >>> y.array
          array([[4., 5.],
                 [0., 1.],
                 [2., 3.]], dtype=float32)
          >>> y = F.permutate(x, indices, inv=True)
          >>> y.array
          array([[2., 3.],
                 [4., 5.],
                 [0., 1.]], dtype=float32)
          >>> indices = np.array([1, 0], np.int32)
          >>> y = F.permutate(x, indices, axis=1)
          >>> y.array
          array([[1., 0.],
                 [3., 2.],
                 [5., 4.]], dtype=float32)
  
      """
      if indices.dtype.kind != "i" or indices.ndim != 1:
          raise ValueError(
              "indices should be a one-dimensional int array"
          )
      if isinstance(indices, chainer.Variable):
          indices = indices.array
      (y,) = Permutate(indices, axis, inv).apply((x,))
      return y
  
file_path: chainer/chainer/functions/array/permutate.py
imports: import numpy
  import six
  import chainer
  from chainer import backend
  from chainer.backends import cuda
  from chainer import function_node
  from chainer.utils import type_check
label_desc: Use image node_id 3 for calling a global function with example usage: permutate(x, indices, axis, inv) and returns: y