code: def rfft(x, n=None, axis=-1, overwrite_x=False, plan=None):
      """Compute the one-dimensional FFT for real input.
  
      The returned real array contains
  
      .. code-block:: python
  
          [y(0),Re(y(1)),Im(y(1)),...,Re(y(n/2))]  # if n is even
          [y(0),Re(y(1)),Im(y(1)),...,Re(y(n/2)),Im(y(n/2))]  # if n is odd
  
      Args:
          x (cupy.ndarray): Array to be transformed.
          n (None or int): Length of the transformed axis of the output. If ``n``
              is not given, the length of the input along the axis specified by
              ``axis`` is used.
          axis (int): Axis over which to compute the FFT.
          overwrite_x (bool): If True, the contents of ``x`` can be destroyed.
          plan (:class:`cupy.cuda.cufft.Plan1d` or ``None``): a cuFFT plan for
              transforming ``x`` over ``axis``, which can be obtained using::
  
                  plan = cupyx.scipy.fftpack.get_fft_plan(
                      x, axes, value_type='R2C')
  
              Note that `plan` is defaulted to None, meaning CuPy will either
              use an auto-generated plan behind the scene if cupy.fft.config.
              enable_nd_planning = True, or use no cuFFT plan if it is set to
              False.
  
      Returns:
          cupy.ndarray:
              The transformed array.
  
      .. seealso:: :func:`scipy.fftpack.rfft`
  
      .. note::
         The argument `plan` is currently experimental and the interface may be
         changed in the future version.
      """
      from cupy.cuda import cufft
  
      if n is None:
          n = x.shape[axis]
  
      shape = list(x.shape)
      shape[axis] = n
      f = _fft(
          x,
          (n,),
          (axis,),
          None,
          cufft.CUFFT_FORWARD,
          "R2C",
          overwrite_x=overwrite_x,
          plan=plan,
      )
      z = cupy.empty(shape, f.real.dtype)
  
      slice_z = [slice(None)] * x.ndim
      slice_f = [slice(None)] * x.ndim
  
      slice_z[axis] = slice(1)
      slice_f[axis] = slice(1)
      z[tuple(slice_z)] = f[tuple(slice_f)].real
  
      slice_z[axis] = slice(1, None, 2)
      slice_f[axis] = slice(1, None)
      z[tuple(slice_z)] = f[tuple(slice_f)].real
  
      slice_z[axis] = slice(2, None, 2)
      slice_f[axis] = slice(1, n - f.shape[axis] + 1)
      z[tuple(slice_z)] = f[tuple(slice_f)].imag
  
      return z
  
file_path: cupy/cupyx/scipy/fftpack/_fft.py
imports: from numpy import prod
  import cupy
  from cupy.fft import config
  from cupy.fft._fft import _convert_fft_type, _default_fft_func, _fft, _get_cufft_plan_nd, _get_fftn_out_size, _output_dtype
  from cupy.fft._cache import get_plan_cache
label_desc: Use image node_id 8 for calling a global function with example usage: rfft(x, n, axis, overwrite_x, plan) and returns: z