code: def fft_abstract_eval(x, fft_type, fft_lengths):
      if len(fft_lengths) > x.ndim:
          raise ValueError(
              f"FFT input shape {x.shape} must have at least as many "
              f"input dimensions as fft_lengths {fft_lengths}."
          )
      if fft_type == xla_client.FftType.RFFT:
          if x.dtype not in (np.float32, np.float64):
              raise ValueError(
                  f"RFFT input must be float32 or float64, got {x.dtype}"
              )
          if x.shape[-len(fft_lengths) :] != fft_lengths:
              raise ValueError(
                  f"RFFT input shape {x.shape} minor dimensions must "
                  f"be equal to fft_lengths {fft_lengths}"
              )
          shape = (
              x.shape[: -len(fft_lengths)]
              + fft_lengths[:-1]
              + (fft_lengths[-1] // 2 + 1,)
          )
          dtype = _complex_dtype(x.dtype)
      elif fft_type == xla_client.FftType.IRFFT:
          if not np.issubdtype(x.dtype, np.complexfloating):
              raise ValueError(
                  "IRFFT input must be complex64 or complex128, got "
                  f"{x.dtype}"
              )
          if x.shape[-len(fft_lengths) : -1] != fft_lengths[:-1]:
              raise ValueError(
                  f"IRFFT input shape {x.shape} minor dimensions must "
                  "be equal to all except the last fft_length, got "
                  f"{fft_lengths=}"
              )
          shape = x.shape[: -len(fft_lengths)] + fft_lengths
          dtype = _real_dtype(x.dtype)
      else:
          if not np.issubdtype(x.dtype, np.complexfloating):
              raise ValueError(
                  "FFT input must be complex64 or complex128, got "
                  f"{x.dtype}"
              )
          if x.shape[-len(fft_lengths) :] != fft_lengths:
              raise ValueError(
                  f"FFT input shape {x.shape} minor dimensions must "
                  f"be equal to fft_lengths {fft_lengths}"
              )
          shape = x.shape
          dtype = x.dtype
      return x.update(shape=shape, dtype=dtype)
  
imports: from __future__ import annotations
  from collections.abc import Sequence
  from functools import partial
  import math
  import numpy
  from jax import lax
  from jax._src import dispatch
  from jax._src.api import jit, linear_transpose, ShapeDtypeStruct
  from jax._src.core import Primitive, is_constant_shape
  from jax._src.interpreters import ad
  from jax._src.interpreters import batching
  from jax._src.interpreters import mlir
  from jax._src.lib.mlir.dialects import hlo
  from jax._src.lib import xla_client
  from jax._src.lib import xla_extension_version
  from jax._src.lib import ducc_fft
  from jax._src.numpy.util import promote_dtypes_complex, promote_dtypes_inexact
label_desc: Use image node_id 4 for calling a global function with example usage: fft_abstract_eval(x, fft_type, fft_lengths) and returns: x