code: def dct(x, type=2, n=None, axis=-1, norm=None, overwrite_x=False):
      """Return the Discrete Cosine Transform of an array, x.
  
      Parameters
      ----------
      x : cupy.ndarray
          The input array.
      type : {1, 2, 3, 4}, optional
          Type of the DCT (see Notes). Default type is 2. Currently CuPy only
          supports types 2 and 3.
      n : int, optional:
          Length of the transform.  If ``n < x.shape[axis]``, `x` is
          truncated. If ``n > x.shape[axis]``, `x` is zero-padded.
          The default results in ``n = x.shape[axis]``.
      axis : int, optional
          Axis along which the dct is computed; the default is over the
          last axis (i.e., ``axis=-1``).
      norm : {"backward", "ortho", "forward"}, optional
          Normalization mode (see Notes). Default is "backward".
      overwrite_x : bool, optional
          If True, the contents of `x` can be destroyed; the default is False.
  
      Returns
      -------
      y : cupy.ndarray of real
          The transformed input array.
  
      See Also
      --------
      :func:`scipy.fft.dct`
  
      Notes
      -----
      For a single dimension array ``x``, ``dct(x, norm='ortho')`` is equal
      to MATLAB ``dct(x)``.
  
      For ``norm="ortho"`` both the `dct` and `idct` are scaled by the same
      overall factor in both directions. By default, the transform is also
      orthogonalized which for types 1, 2 and 3 means the transform definition is
      modified to give orthogonality of the DCT matrix (see below).
  
      For ``norm="backward"``, there is no scaling on `dct` and the `idct` is
      scaled by ``1/N`` where ``N`` is the "logical" size of the DCT. For
      ``norm="forward"`` the ``1/N`` normalization is applied to the forward
      `dct` instead and the `idct` is unnormalized.
  
      CuPy currently only supports DCT types 2 and 3. 'The' DCT generally
      refers to DCT type 2, and 'the' Inverse DCT generally refers to DCT
      type 3 [1]_. See the :func:`scipy.fft.dct` documentation for a full
      description of each type.
  
      References
      ----------
      .. [1] Wikipedia, "Discrete cosine transform",
             https://en.wikipedia.org/wiki/Discrete_cosine_transform
  
      """
      if x.dtype.kind == "c":
          # separable application on real and imaginary parts
          out = dct(x.real, type, n, axis, norm, overwrite_x)
          out = out + 1j * dct(x.imag, type, n, axis, norm, overwrite_x)
          return out
  
      x = _promote_dtype(x)
  
      if type == 2:
          return _dct_or_dst_type2(
              x, n=n, axis=axis, norm=norm, forward=True, dst=False
          )
      elif type == 3:
          return _dct_or_dst_type3(
              x, n=n, axis=axis, norm=norm, forward=True, dst=False
          )
      elif type in [1, 4]:
          raise NotImplementedError(
              "Only DCT-II and DCT-III have been implemented."
          )
      else:
          raise ValueError("invalid DCT type")
  
imports: import math
  import numbers
  import operator
  import numpy
  import cupy
  from cupy import _core
  from cupy.fft._fft import _cook_shape
  from cupyx.scipy.fft import _fft
label_desc: Use image node_id 9 for calling a global function with example usage: dct(x, type, n, axis, norm, overwrite_x) and returns: out, _dct_or_dst_type2, _dct_or_dst_type3