code: def fft(
      x: paddle.Tensor,
      dim: int,
      /,
      *,
      norm: Optional[str] = "backward",
      n: Optional[Union[int, Tuple[int]]] = None,
      out: Optional[paddle.Tensor] = None,
  ) -> paddle.Tensor:
      if not isinstance(dim, int):
          raise IvyValueError(
              f"Expecting <class 'int'> instead of {type(dim)}"
          )
  
      if n is None:
          n = x.shape[dim]
  
      if dim < -x.ndim or dim >= x.ndim:
          raise IvyValueError(
              f"Invalid dim {dim}, expecting a value ranging from {-x.ndim} to {x.ndim-1}"
          )
  
      if not isinstance(n, int):
          raise TypeError(
              f"Expecting int type for 'n', instead of {type(n)}"
          )
  
      if n <= 1:
          raise IvyValueError(
              f"Invalid number of data points {n}, expecting more than 1"
          )
  
      valid_norm_modes = ["backward", "ortho", "forward"]
      if norm not in valid_norm_modes:
          raise IvyValueError(
              f"Unrecognized normalization mode {norm}, expecting one of"
              f" {valid_norm_modes}"
          )
  
      ret = paddle.fft.fft(x, n, dim, norm=norm)
      # to make it compatible with other backends
      if x.dtype == paddle.int64:
          ret = ret.astype("complex128")
      return ret
  
imports: from typing import Optional, Union, Tuple, List, Literal, Sequence, Callable
  import paddle
  from ivy.functional.ivy.layers import _handle_padding, _depth_max_pooling_helper, _validate_max_pool_params
  from ivy.utils.exceptions import IvyNotImplementedException, IvyValueError
  from ivy.func_wrapper import with_supported_device_and_dtypes, with_unsupported_dtypes, with_supported_dtypes
  from ..None import backend_version
  import ivy
label_desc: Use image node_id 9 for calling a global function with example usage: fft() and returns: ret