code: def argrelextrema(data, comparator, axis=0, order=1, mode="clip"):
      """
      Calculate the relative extrema of `data`.
  
      Parameters
      ----------
      data : ndarray
          Array in which to find the relative extrema.
      comparator : callable
          Function to use to compare two data points.
          Should take two arrays as arguments.
      axis : int, optional
          Axis over which to select from `data`.  Default is 0.
      order : int, optional
          How many points on each side to use for the comparison
          to consider ``comparator(n, n+x)`` to be True.
  
      Returns
      -------
      extrema : tuple of ndarrays
          Indices of the maxima in arrays of integers.  ``extrema[k]`` is
          the array of indices of axis `k` of `data`.  Note that the
          return value is a tuple even when `data` is one-dimensional.
  
      See Also
      --------
      argrelmin, argrelmax
  
      Examples
      --------
      >>> from cusignal import argrelextrema
      >>> import cupy as cp
      >>> x = cp.array([2, 1, 2, 3, 2, 0, 1, 0])
      >>> argrelextrema(x, cp.greater)
      (array([3, 6]),)
      >>> y = cp.array([[1, 2, 1, 2],
      ...               [2, 2, 0, 0],
      ...               [5, 3, 4, 4]])
      ...
      >>> argrelextrema(y, cp.less, axis=1)
      (array([0, 2]), array([2, 1]))
  
      """
      data = cp.asarray(data)
      results = _boolrelextrema(data, comparator, axis, order, mode)
  
      if mode == "raise":
          raise NotImplementedError(
              "CuPy `take` doesn't support `mode='raise'`."
          )
  
      return cp.nonzero(results)
  
imports: import cupy
  from ._peak_finding_cuda import _peak_finding
label_desc: Use image node_id 4 for calling a global function with example usage: argrelextrema(data, comparator, axis, order, mode) and returns: cp