def ifftshift(
    x: ndarray, axes: int | tuple[int, ...] | None = None
) -> ndarray:
    """
    The inverse of `fftshift`. Although identical for even-length `x`, the
    functions differ by one sample for odd-length `x`.

    Parameters
    ----------
    x : array_like
        Input array.

    axes : int or shape tuple, optional
        Axes over which to calculate.  Defaults to None, which shifts all axes.

    Returns
    -------
    y : ndarray
        The shifted array.

    Availability
    --------
    Multiple GPUs, Multiple CPUs
    """
    shift: int | tuple[int, ...]
    if axes is None:
        axes = tuple(range(x.ndim))
        shift = tuple(-(dim // 2) for dim in x.shape)
    elif isinstance(axes, integer_types):
        shift = -(x.shape[axes] // 2)
    else:
        shift = tuple(-(x.shape[ax] // 2) for ax in axes)

    return roll(x, shift, axes)

    The inverse of `fftshift`. Although identical for even-length `x`, the
    functions differ by one sample for odd-length `x`.

    Parameters
    ----------
    x : array_like
        Input array.

    axes : int or shape tuple, optional
        Axes over which to calculate.  Defaults to None, which shifts all axes.

    Returns
    -------
    y : ndarray
        The shifted array.

    Availability
    --------
    Multiple GPUs, Multiple CPUs
    
cupynumeric/fft/fft.py