[-0.2000,  0.8000,  1.8000, -2.2000, -1.2000],
           [-0.1000,  0.9000,  1.9000, -2.1000, -1.1000]])



torch.fft.fftshift(x)
   tensor([[-2.2000, -1.2000, -0.2000,  0.8000,  1.8000],
           [-2.1000, -1.1000, -0.1000,  0.9000,  1.9000],
           [-2.0000, -1.0000,  0.0000,  1.0000,  2.0000],
           [-1.9000, -0.9000,  0.1000,  1.1000,  2.1000],
           [-1.8000, -0.8000,  0.2000,  1.2000,  2.2000]])



"fftshift()" can also be useful for spatial data. If our data is
   defined on a centered grid ("[-(N//2), (N-1)//2]") then we can use
   the standard FFT defined on an uncentered grid ("[0, N)") by first
   applying an "ifftshift()".



x_centered = torch.arange(-5, 5)
x_uncentered = torch.fft.ifftshift(x_centered)
fft_uncentered = torch.fft.fft(x_uncentered)



Similarly, we can convert the frequency domain components to
   centered convention by applying "fftshift()".



fft_centered = torch.fft.fftshift(fft_uncentered)


