code: def ifft(
      x: Union[tf.Tensor, tf.Variable],
      dim: int,
      *,
      norm: str = "backward",
      n: Optional[Union[int, Tuple[int]]] = None,
      out: Optional[Union[tf.Tensor, tf.Variable]] = None,
  ) -> Union[tf.Tensor, tf.Variable]:
      if not isinstance(dim, int):
          raise ivy.utils.exceptions.IvyError(
              f"Expecting <class 'int'> instead of {type(dim)}"
          )
      if n is None:
          n = x.shape[dim]
      if n < -len(x.shape):
          raise ivy.utils.exceptions.IvyError(
              f"Invalid dim {dim}, expecting ranging"
              " from {-len(x.shape)} to {len(x.shape)-1}  "
          )
      if not isinstance(n, int):
          raise ivy.utils.exceptions.IvyError(
              f"Expecting <class 'int'> instead of {type(n)}"
          )
      if n <= 1:
          raise ivy.utils.exceptions.IvyError(
              f"Invalid data points {n}, expecting more than 1"
          )
      if norm not in ["backward", "ortho", "forward"]:
          raise ivy.utils.exceptions.IvyError(
              f"Unrecognized normalization mode {norm}"
          )
      if x.shape[dim] != n:
          s = list(x.shape)
          if s[dim] > n:
              index = [slice(None)] * len(s)
              index[dim] = slice(0, n)
              x = x[tuple(index)]
              del index
          else:
              s[dim] = n - s[dim]
              z = tf.zeros(s, x.dtype)
              x = tf.concat([x, z], axis=dim)
          del s
      operation_name = (
          f"{n} points FFT at dim {dim} with {norm} normalization"
      )
      if dim != -1 or dim != len(x.shape) - 1:
          permute = [i for i in range(len(x.shape))]
          permute[dim], permute[-1] = permute[-1], permute[dim]
          x = tf.transpose(x, permute)
          ret = tf.signal.ifft(x, operation_name)
          ret = tf.transpose(ret, permute)
          del permute
      else:
          ret = tf.signal.ifft(x, operation_name)
      ret = _ifft_norm(ret, dim, norm=norm)
      return ret
  
imports: import math
  from typing import Union, Optional, Tuple, List, Literal, Sequence, Callable
  import tensorflow
  from ivy.func_wrapper import inputs_to_ivy_arrays, output_to_native_arrays, with_unsupported_dtypes, with_supported_dtypes, with_supported_device_and_dtypes
  from ..None import backend_version
  import ivy
  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, _get_size
label_desc: Use image node_id 19 for calling a global function with example usage: ifft(x, dim) and returns: ret