Expected isFloatingType(grad.scalar_type()) || (input_is_complex == grad_is_complex) to be true, but got false

I got the same problem when using torch.fft.fft().
As an alternative, I used the old representation, torch.fft(). This function can avoid this bug.