import torch


def fftc_torch(data, dim=(-2, -1), norm="ortho"):
    """
    Centered fast fourier transform for torch.Tensor
    """
    return torch.fft.fftshift(
        torch.fft.fftn(torch.fft.ifftshift(data, dim=dim),
            dim=dim, norm=norm),
        dim=dim
    )