Pytorch inverse FFT (ifft) with amplitude and phase
To use the amplitude and phase, I use the below function to extract:
def calculate_fft(x):
    fft_im = torch.fft.fft(x.clone())  # bx3xhxw
    fft_amp = fft_im.real**2 + fft_im.imag**2
    fft_amp = torch.sqrt(fft_amp)
    fft_pha = torch.atan2(fft_im.imag, fft_im.real)
    return fft_amp, fft_pha

After I modifying the amp and pha, how to use them to perform inverse FFT?
y = fft_amp * torch.sin(fft_pha)

This does not work. I am not good at maths. :-(

def inverse_fft(fft_amp, fft_pha):
    imag = fft_amp * torch.sin(fft_pha)
    real = fft_amp * torch.cos(fft_pha)
    fft_y = torch.complex(real, imag)
    y = torch.fft.ifft(fft_y)
    return y

This may work.
