prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  ifft2
  
  ifft2
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `ivy/functional/frontends/numpy/fft/discrete_fourier_transform.py`
  Content:
  ```
  1 import ivy
  2 from ivy.functional.frontends.numpy.func_wrapper import to_ivy_arrays_and_back
  3 from ivy.func_wrapper import with_unsupported_dtypes
  4 
  5 
  6 # --- Helpers --- #
  7 # --------------- #
  8 
  9 
  10 def _swap_direction(norm):
  11     try:
  12         return _SWAP_DIRECTION_MAP[norm]
  13     except KeyError:
  14         raise ValueError(
  15             f'Invalid norm value {norm}; should be "backward", "ortho" or "forward".'
  16         ) from None
  17 
  18 
  19 # --- Main --- #
  20 # ------------ #
  21 
  22 
  23 @to_ivy_arrays_and_back
  24 def fft(a, n=None, axis=-1, norm=None):
  25     return ivy.fft(ivy.astype(a, ivy.complex128), axis, norm=norm, n=n)
  26 
  27 
  28 @with_unsupported_dtypes({"1.26.0 and below": ("int",)}, "numpy")
  29 @to_ivy_arrays_and_back
  30 def fftfreq(n, d=1.0):
  31     if not isinstance(
  32         n, (int, type(ivy.int8), type(ivy.int16), type(ivy.int32), type(ivy.int64))
  33     ):
  34         raise ValueError("n should be an integer")
  35 
  36     N = (n - 1) // 2 + 1
  37     val = 1.0 / (n * d)
  38     results = ivy.empty(tuple([n]), dtype=int)
  39 
  40     p1 = ivy.arange(0, N, dtype=int)
  41     results[:N] = p1
  42     p2 = ivy.arange(-(n // 2), 0, dtype=int)
  43     results[N:] = p2
  44 
  45     return results * val
  46 
  47 
  48 @to_ivy_arrays_and_back
  49 @with_unsupported_dtypes({"1.26.0 and below": ("float16",)}, "numpy")
  50 def fftshift(x, axes=None):
  51     x = ivy.asarray(x)
  52 
  53     if axes is None:
  54         axes = tuple(range(x.ndim))
  55         shift = [(dim // 2) for dim in x.shape]
  56     elif isinstance(
  57         axes,
  58         (int, type(ivy.uint8), type(ivy.uint16), type(ivy.uint32), type(ivy.uint64)),
  59     ):
  60         shift = x.shape[axes] // 2
  61     else:
  62         shift = [(x.shape[ax] // 2) for ax in axes]
  63 
  64     roll = ivy.roll(x, shift, axis=axes)
  65 
  66     return roll
  67 
  68 
  69 @to_ivy_arrays_and_back
  70 def ifft(a, n=None, axis=-1, norm=None):
  71     a = ivy.array(a, dtype=ivy.complex128)
  72     if norm is None:
  73         norm = "backward"
  74     return ivy.ifft(a, axis, norm=norm, n=n)
  75 
  76 
  77 @with_unsupported_dtypes({"1.24.3 and below": ("float16",)}, "numpy")
  78 @to_ivy_arrays_and_back
  79 def ifftn(a, s=None, axes=None, norm=None):
  80     a = ivy.asarray(a, dtype=ivy.complex128)
  81     a = ivy.ifftn(a, s=s, axes=axes, norm=norm)
  82     return a
  83 
  84 
  85 @to_ivy_arrays_and_back
  86 @with_unsupported_dtypes({"1.26.0 and below": ("float16",)}, "numpy")
  87 def ifftshift(x, axes=None):
  88     x = ivy.asarray(x)
  89 
  90     if axes is None:
  91         axes = tuple(range(x.ndim))
  92         shift = [-(dim // 2) for dim in x.shape]
  93     elif isinstance(
  94         axes,
  95         (int, type(ivy.uint8), type(ivy.uint16), type(ivy.uint32), type(ivy.uint64)),
  96     ):
  97         shift = -(x.shape[axes] // 2)
  98     else:
  99         shift = [-(x.shape[ax] // 2) for ax in axes]
  100 
  101     roll = ivy.roll(x, shift, axis=axes)
  102 
  103     return roll
  104 
  105 
  106 @with_unsupported_dtypes({"1.26.0 and below": ("float16",)}, "numpy")
  107 @to_ivy_arrays_and_back
  108 def ihfft(a, n=None, axis=-1, norm=None):
  109     if n is None:
  110         n = a.shape[axis]
  111     norm = _swap_direction(norm)
  112     output = ivy.conj(rfft(a, n, axis, norm=norm).ivy_array)
  113     return output
  114 
  115 
  116 @with_unsupported_dtypes({"1.26.0 and below": ("float16",)}, "numpy")
  117 @to_ivy_arrays_and_back
  118 def rfft(a, n=None, axis=-1, norm=None):
  119     if norm is None:
  120         norm = "backward"
  121     a = ivy.array(a, dtype=ivy.float64)
  122     return ivy.dft(a, axis=axis, inverse=False, onesided=True, dft_length=n, norm=norm)
  123 
  124 
  125 @to_ivy_arrays_and_back
  126 def rfftfreq(n, d=1.0):
  127     if not isinstance(
  128         n, (int, type(ivy.int8), type(ivy.int16), type(ivy.int32), type(ivy.int64))
  129     ):
  130         raise ValueError("n should be an integer")
  131 
  132     val = 1.0 / (n * d)
  133     N = n // 2 + 1
  134     results = ivy.arange(0, N, dtype=int)
  135     return results * val
  136 
  137 
  138 @with_unsupported_dtypes({"1.24.3 and below": ("float16",)}, "numpy")
  139 @to_ivy_arrays_and_back
  140 def rfftn(a, s=None, axes=None, norm=None):
  141     a = ivy.asarray(a, dtype=ivy.complex128)
  142     return ivy.rfftn(a, s=s, axes=axes, norm=norm)
  143 
  144 
  145 _SWAP_DIRECTION_MAP = {
  146     None: "forward",
  147     "backward": "forward",
  148     "ortho": "ortho",
  149     "forward": "backward",
  150 }
  151
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/ivy/functional/frontends/numpy/fft/discrete_fourier_transform.py b/ivy/functional/frontends/numpy/fft/discrete_fourier_transform.py
  --- a/ivy/functional/frontends/numpy/fft/discrete_fourier_transform.py
  +++ b/ivy/functional/frontends/numpy/fft/discrete_fourier_transform.py
  @@ -74,6 +74,14 @@
       return ivy.ifft(a, axis, norm=norm, n=n)
   
   
  +@with_unsupported_dtypes({"1.24.3 and below": ("float16",)}, "numpy")
  +@to_ivy_arrays_and_back
  +def ifft2(a, s=None, axes=(-2, -1), norm=None):
  +    a = ivy.asarray(a, dtype=ivy.complex128)
  +    a = ivy.ifftn(a, s=s, axes=axes, norm=norm)
  +    return a
  +
  +
   @with_unsupported_dtypes({"1.24.3 and below": ("float16",)}, "numpy")
   @to_ivy_arrays_and_back
   def ifftn(a, s=None, axes=None, norm=None):
  
verification_info: {"golden_diff": "diff --git a/ivy/functional/frontends/numpy/fft/discrete_fourier_transform.py b/ivy/functional/frontends/numpy/fft/discrete_fourier_transform.py\n--- a/ivy/functional/frontends/numpy/fft/discrete_fourier_transform.py\n+++ b/ivy/functional/frontends/numpy/fft/discrete_fourier_transform.py\n@@ -74,6 +74,14 @@\n     return ivy.ifft(a, axis, norm=norm, n=n)\n \n \n+@with_unsupported_dtypes({\"1.24.3 and below\": (\"float16\",)}, \"numpy\")\n+@to_ivy_arrays_and_back\n+def ifft2(a, s=None, axes=(-2, -1), norm=None):\n+    a = ivy.asarray(a, dtype=ivy.complex128)\n+    a = ivy.ifftn(a, s=s, axes=axes, norm=norm)\n+    return a\n+\n+\n @with_unsupported_dtypes({\"1.24.3 and below\": (\"float16\",)}, \"numpy\")\n @to_ivy_arrays_and_back\n def ifftn(a, s=None, axes=None, norm=None):\n", "issue": "ifft2\n\nifft2\n\n", "before_files": [{"content": "import ivy\nfrom ivy.functional.frontends.numpy.func_wrapper import to_ivy_arrays_and_back\nfrom ivy.func_wrapper import with_unsupported_dtypes\n\n\n# --- Helpers --- #\n# --------------- #\n\n\ndef _swap_direction(norm):\n    try:\n        return _SWAP_DIRECTION_MAP[norm]\n    except KeyError:\n        raise ValueError(\n            f'Invalid norm value {norm}; should be \"backward\", \"ortho\" or \"forward\".'\n        ) from None\n\n\n# --- Main --- #\n# ------------ #\n\n\n@to_ivy_arrays_and_back\ndef fft(a, n=None, axis=-1, norm=None):\n    return ivy.fft(ivy.astype(a, ivy.complex128), axis, norm=norm, n=n)\n\n\n@with_unsupported_dtypes({\"1.26.0 and below\": (\"int\",)}, \"numpy\")\n@to_ivy_arrays_and_back\ndef fftfreq(n, d=1.0):\n    if not isinstance(\n        n, (int, type(ivy.int8), type(ivy.int16), type(ivy.int32), type(ivy.int64))\n    ):\n        raise ValueError(\"n should be an integer\")\n\n    N = (n - 1) // 2 + 1\n    val = 1.0 / (n * d)\n    results = ivy.empty(tuple([n]), dtype=int)\n\n    p1 = ivy.arange(0, N, dtype=int)\n    results[:N] = p1\n    p2 = ivy.arange(-(n // 2), 0, dtype=int)\n    results[N:] = p2\n\n    return results * val\n\n\n@to_ivy_arrays_and_back\n@with_unsupported_dtypes({\"1.26.0 and below\": (\"float16\",)}, \"numpy\")\ndef fftshift(x, axes=None):\n    x = ivy.asarray(x)\n\n    if axes is None:\n        axes = tuple(range(x.ndim))\n        shift = [(dim // 2) for dim in x.shape]\n    elif isinstance(\n        axes,\n        (int, type(ivy.uint8), type(ivy.uint16), type(ivy.uint32), type(ivy.uint64)),\n    ):\n        shift = x.shape[axes] // 2\n    else:\n        shift = [(x.shape[ax] // 2) for ax in axes]\n\n    roll = ivy.roll(x, shift, axis=axes)\n\n    return roll\n\n\n@to_ivy_arrays_and_back\ndef ifft(a, n=None, axis=-1, norm=None):\n    a = ivy.array(a, dtype=ivy.complex128)\n    if norm is None:\n        norm = \"backward\"\n    return ivy.ifft(a, axis, norm=norm, n=n)\n\n\n@with_unsupported_dtypes({\"1.24.3 and below\": (\"float16\",)}, \"numpy\")\n@to_ivy_arrays_and_back\ndef ifftn(a, s=None, axes=None, norm=None):\n    a = ivy.asarray(a, dtype=ivy.complex128)\n    a = ivy.ifftn(a, s=s, axes=axes, norm=norm)\n    return a\n\n\n@to_ivy_arrays_and_back\n@with_unsupported_dtypes({\"1.26.0 and below\": (\"float16\",)}, \"numpy\")\ndef ifftshift(x, axes=None):\n    x = ivy.asarray(x)\n\n    if axes is None:\n        axes = tuple(range(x.ndim))\n        shift = [-(dim // 2) for dim in x.shape]\n    elif isinstance(\n        axes,\n        (int, type(ivy.uint8), type(ivy.uint16), type(ivy.uint32), type(ivy.uint64)),\n    ):\n        shift = -(x.shape[axes] // 2)\n    else:\n        shift = [-(x.shape[ax] // 2) for ax in axes]\n\n    roll = ivy.roll(x, shift, axis=axes)\n\n    return roll\n\n\n@with_unsupported_dtypes({\"1.26.0 and below\": (\"float16\",)}, \"numpy\")\n@to_ivy_arrays_and_back\ndef ihfft(a, n=None, axis=-1, norm=None):\n    if n is None:\n        n = a.shape[axis]\n    norm = _swap_direction(norm)\n    output = ivy.conj(rfft(a, n, axis, norm=norm).ivy_array)\n    return output\n\n\n@with_unsupported_dtypes({\"1.26.0 and below\": (\"float16\",)}, \"numpy\")\n@to_ivy_arrays_and_back\ndef rfft(a, n=None, axis=-1, norm=None):\n    if norm is None:\n        norm = \"backward\"\n    a = ivy.array(a, dtype=ivy.float64)\n    return ivy.dft(a, axis=axis, inverse=False, onesided=True, dft_length=n, norm=norm)\n\n\n@to_ivy_arrays_and_back\ndef rfftfreq(n, d=1.0):\n    if not isinstance(\n        n, (int, type(ivy.int8), type(ivy.int16), type(ivy.int32), type(ivy.int64))\n    ):\n        raise ValueError(\"n should be an integer\")\n\n    val = 1.0 / (n * d)\n    N = n // 2 + 1\n    results = ivy.arange(0, N, dtype=int)\n    return results * val\n\n\n@with_unsupported_dtypes({\"1.24.3 and below\": (\"float16\",)}, \"numpy\")\n@to_ivy_arrays_and_back\ndef rfftn(a, s=None, axes=None, norm=None):\n    a = ivy.asarray(a, dtype=ivy.complex128)\n    return ivy.rfftn(a, s=s, axes=axes, norm=norm)\n\n\n_SWAP_DIRECTION_MAP = {\n    None: \"forward\",\n    \"backward\": \"forward\",\n    \"ortho\": \"ortho\",\n    \"forward\": \"backward\",\n}\n", "path": "ivy/functional/frontends/numpy/fft/discrete_fourier_transform.py"}], "after_files": [{"content": "import ivy\nfrom ivy.functional.frontends.numpy.func_wrapper import to_ivy_arrays_and_back\nfrom ivy.func_wrapper import with_unsupported_dtypes\n\n\n# --- Helpers --- #\n# --------------- #\n\n\ndef _swap_direction(norm):\n    try:\n        return _SWAP_DIRECTION_MAP[norm]\n    except KeyError:\n        raise ValueError(\n            f'Invalid norm value {norm}; should be \"backward\", \"ortho\" or \"forward\".'\n        ) from None\n\n\n# --- Main --- #\n# ------------ #\n\n\n@to_ivy_arrays_and_back\ndef fft(a, n=None, axis=-1, norm=None):\n    return ivy.fft(ivy.astype(a, ivy.complex128), axis, norm=norm, n=n)\n\n\n@with_unsupported_dtypes({\"1.26.0 and below\": (\"int\",)}, \"numpy\")\n@to_ivy_arrays_and_back\ndef fftfreq(n, d=1.0):\n    if not isinstance(\n        n, (int, type(ivy.int8), type(ivy.int16), type(ivy.int32), type(ivy.int64))\n    ):\n        raise ValueError(\"n should be an integer\")\n\n    N = (n - 1) // 2 + 1\n    val = 1.0 / (n * d)\n    results = ivy.empty(tuple([n]), dtype=int)\n\n    p1 = ivy.arange(0, N, dtype=int)\n    results[:N] = p1\n    p2 = ivy.arange(-(n // 2), 0, dtype=int)\n    results[N:] = p2\n\n    return results * val\n\n\n@to_ivy_arrays_and_back\n@with_unsupported_dtypes({\"1.26.0 and below\": (\"float16\",)}, \"numpy\")\ndef fftshift(x, axes=None):\n    x = ivy.asarray(x)\n\n    if axes is None:\n        axes = tuple(range(x.ndim))\n        shift = [(dim // 2) for dim in x.shape]\n    elif isinstance(\n        axes,\n        (int, type(ivy.uint8), type(ivy.uint16), type(ivy.uint32), type(ivy.uint64)),\n    ):\n        shift = x.shape[axes] // 2\n    else:\n        shift = [(x.shape[ax] // 2) for ax in axes]\n\n    roll = ivy.roll(x, shift, axis=axes)\n\n    return roll\n\n\n@to_ivy_arrays_and_back\ndef ifft(a, n=None, axis=-1, norm=None):\n    a = ivy.array(a, dtype=ivy.complex128)\n    if norm is None:\n        norm = \"backward\"\n    return ivy.ifft(a, axis, norm=norm, n=n)\n\n\n@with_unsupported_dtypes({\"1.24.3 and below\": (\"float16\",)}, \"numpy\")\n@to_ivy_arrays_and_back\ndef ifft2(a, s=None, axes=(-2, -1), norm=None):\n    a = ivy.asarray(a, dtype=ivy.complex128)\n    a = ivy.ifftn(a, s=s, axes=axes, norm=norm)\n    return a\n\n\n@with_unsupported_dtypes({\"1.24.3 and below\": (\"float16\",)}, \"numpy\")\n@to_ivy_arrays_and_back\ndef ifftn(a, s=None, axes=None, norm=None):\n    a = ivy.asarray(a, dtype=ivy.complex128)\n    a = ivy.ifftn(a, s=s, axes=axes, norm=norm)\n    return a\n\n\n@to_ivy_arrays_and_back\n@with_unsupported_dtypes({\"1.26.0 and below\": (\"float16\",)}, \"numpy\")\ndef ifftshift(x, axes=None):\n    x = ivy.asarray(x)\n\n    if axes is None:\n        axes = tuple(range(x.ndim))\n        shift = [-(dim // 2) for dim in x.shape]\n    elif isinstance(\n        axes,\n        (int, type(ivy.uint8), type(ivy.uint16), type(ivy.uint32), type(ivy.uint64)),\n    ):\n        shift = -(x.shape[axes] // 2)\n    else:\n        shift = [-(x.shape[ax] // 2) for ax in axes]\n\n    roll = ivy.roll(x, shift, axis=axes)\n\n    return roll\n\n\n@with_unsupported_dtypes({\"1.26.0 and below\": (\"float16\",)}, \"numpy\")\n@to_ivy_arrays_and_back\ndef ihfft(a, n=None, axis=-1, norm=None):\n    if n is None:\n        n = a.shape[axis]\n    norm = _swap_direction(norm)\n    output = ivy.conj(rfft(a, n, axis, norm=norm).ivy_array)\n    return output\n\n\n@with_unsupported_dtypes({\"1.26.0 and below\": (\"float16\",)}, \"numpy\")\n@to_ivy_arrays_and_back\ndef rfft(a, n=None, axis=-1, norm=None):\n    if norm is None:\n        norm = \"backward\"\n    a = ivy.array(a, dtype=ivy.float64)\n    return ivy.dft(a, axis=axis, inverse=False, onesided=True, dft_length=n, norm=norm)\n\n\n@to_ivy_arrays_and_back\ndef rfftfreq(n, d=1.0):\n    if not isinstance(\n        n, (int, type(ivy.int8), type(ivy.int16), type(ivy.int32), type(ivy.int64))\n    ):\n        raise ValueError(\"n should be an integer\")\n\n    val = 1.0 / (n * d)\n    N = n // 2 + 1\n    results = ivy.arange(0, N, dtype=int)\n    return results * val\n\n\n@with_unsupported_dtypes({\"1.24.3 and below\": (\"float16\",)}, \"numpy\")\n@to_ivy_arrays_and_back\ndef rfftn(a, s=None, axes=None, norm=None):\n    a = ivy.asarray(a, dtype=ivy.complex128)\n    return ivy.rfftn(a, s=s, axes=axes, norm=norm)\n\n\n_SWAP_DIRECTION_MAP = {\n    None: \"forward\",\n    \"backward\": \"forward\",\n    \"ortho\": \"ortho\",\n    \"forward\": \"backward\",\n}\n", "path": "ivy/functional/frontends/numpy/fft/discrete_fourier_transform.py"}]}