original_docstring: Multi-dimensional rank filter.
  
      Args:
          input (cupy.ndarray): The input array.
          rank (int): The rank of the element to get. Can be negative to count
              from the largest value, e.g. ``-1`` indicates the largest value.
          size (int or sequence of int): One of ``size`` or ``footprint`` must be
              provided. If ``footprint`` is given, ``size`` is ignored. Otherwise
              ``footprint = cupy.ones(size)`` with ``size`` automatically made to
              match the number of dimensions in ``input``.
          footprint (cupy.ndarray): a boolean array which specifies which of the
              elements within this shape will get passed to the filter function.
          output (cupy.ndarray, dtype or None): The array in which to place the
              output. Default is is same dtype as the input.
          mode (str): The array borders are handled according to the given mode
              (``'reflect'``, ``'constant'``, ``'nearest'``, ``'mirror'``,
              ``'wrap'``). Default is ``'reflect'``.
          cval (scalar): Value to fill past edges of input if mode is
              ``'constant'``. Default is ``0.0``.
          origin (int or sequence of int): The origin parameter controls the
              placement of the filter, relative to the center of the current
              element of the input. Default of 0 is equivalent to
              ``(0,)*input.ndim``.
  
      Returns:
          cupy.ndarray: The result of the filtering.
  
      .. seealso:: :func:`scipy.ndimage.rank_filter`
      
docstring: Multi-dimensional rank filter.
docstring_tokens: Multi - dimensional rank filter .
code: def rank_filter(input, rank, size=None, footprint=None, output=None,
                  mode="reflect", cval=0.0, origin=0):
      """Multi-dimensional rank filter.
  
      Args:
          input (cupy.ndarray): The input array.
          rank (int): The rank of the element to get. Can be negative to count
              from the largest value, e.g. ``-1`` indicates the largest value.
          size (int or sequence of int): One of ``size`` or ``footprint`` must be
              provided. If ``footprint`` is given, ``size`` is ignored. Otherwise
              ``footprint = cupy.ones(size)`` with ``size`` automatically made to
              match the number of dimensions in ``input``.
          footprint (cupy.ndarray): a boolean array which specifies which of the
              elements within this shape will get passed to the filter function.
          output (cupy.ndarray, dtype or None): The array in which to place the
              output. Default is is same dtype as the input.
          mode (str): The array borders are handled according to the given mode
              (``'reflect'``, ``'constant'``, ``'nearest'``, ``'mirror'``,
              ``'wrap'``). Default is ``'reflect'``.
          cval (scalar): Value to fill past edges of input if mode is
              ``'constant'``. Default is ``0.0``.
          origin (int or sequence of int): The origin parameter controls the
              placement of the filter, relative to the center of the current
              element of the input. Default of 0 is equivalent to
              ``(0,)*input.ndim``.
  
      Returns:
          cupy.ndarray: The result of the filtering.
  
      .. seealso:: :func:`scipy.ndimage.rank_filter`
      """
      rank = int(rank)
      return _rank_filter(input, lambda fs: rank+fs if rank < 0 else rank,
                          size, footprint, output, mode, cval, origin)
code_tokens: def rank_filter ( input , rank , size = None , footprint = None , output = None , mode = "reflect" , cval = 0.0 , origin = 0 ) : rank = int ( rank ) return _rank_filter ( input , lambda fs : rank + fs if rank < 0 else rank , size , footprint , output , mode , cval , origin )
short_docstring: Multi-dimensional rank filter.
short_docstring_tokens: Multi - dimensional rank filter .
comment: """Multi-dimensional rank filter.
  
      Args:
          input (cupy.ndarray): The input array.
          rank (int): The rank of the element to get. Can be negative to count
              from the largest value, e.g. ``-1`` indicates the largest value.
          size (int or sequence of int): One of ``size`` or ``footprint`` must be
              provided. If ``footprint`` is given, ``size`` is ignored. Otherwise
              ``footprint = cupy.ones(size)`` with ``size`` automatically made to
              match the number of dimensions in ``input``.
          footprint (cupy.ndarray): a boolean array which specifies which of the
              elements within this shape will get passed to the filter function.
          output (cupy.ndarray, dtype or None): The array in which to place the
              output. Default is is same dtype as the input.
          mode (str): The array borders are handled according to the given mode
              (``'reflect'``, ``'constant'``, ``'nearest'``, ``'mirror'``,
              ``'wrap'``). Default is ``'reflect'``.
          cval (scalar): Value to fill past edges of input if mode is
              ``'constant'``. Default is ``0.0``.
          origin (int or sequence of int): The origin parameter controls the
              placement of the filter, relative to the center of the current
              element of the input. Default of 0 is equivalent to
              ``(0,)*input.ndim``.
  
      Returns:
          cupy.ndarray: The result of the filtering.
  
      .. seealso:: :func:`scipy.ndimage.rank_filter`
      """