code: def fft2(
      x: torch.Tensor,
      *,
      s: Optional[Sequence[int]] = None,
      dim: Sequence[int] = (-2, -1),
      norm: str = "backward",
      out: Optional[torch.Tensor] = None,
  ) -> torch.Tensor:
      if not all(isinstance(j, int) for j in dim):
          raise ivy.utils.exceptions.IvyError(
              f"Expecting {dim} to be a sequence of integers <class integer>"
          )
      if s is None:
          s = (x.shape[dim[0]], x.shape[dim[1]])
      if all(j < -len(x.shape) for j in s):
          raise ivy.utils.exceptions.IvyError(
              f"Invalid dim {dim}, expecting ranging"
              " from {-len(x.shape)} to {len(x.shape)-1}  "
          )
      if not all(isinstance(j, int) for j in s):
          raise ivy.utils.exceptions.IvyError(
              f"Expecting {s} to be a sequence of integers <class integer>"
          )
      if all(j <= 1 for j in s):
          raise ivy.utils.exceptions.IvyError(
              f"Invalid data points {s}, expecting s points larger than 1"
          )
      if norm not in {"backward", "ortho", "forward"}:
          raise ivy.utils.exceptions.IvyError(
              f"Unrecognized normalization mode {norm}"
          )
      return torch.tensor(
          torch.fft.fft2(x, s, dim, norm, out=out),
          dtype=torch.complex128,
      )
  
imports: from typing import Optional, Union, Tuple, List, Literal, Sequence, Callable
  import torch
  import math
  import ivy
  from ivy.func_wrapper import with_unsupported_dtypes, with_supported_dtypes
  from .None import backend_version
  from ivy.functional.ivy.layers import _handle_padding, _get_num_padded_values, _validate_max_pool_params, _depth_max_pooling_helper
  from ivy.functional.ivy.experimental.layers import _padding_ceil_mode, _broadcast_pooling_helper
label_desc: Use image node_id 24 for calling a global function with example usage: fft2(x) and returns: torch