If you want to use the old torch.fft function, the input should have size 2 along the last dimension, where x[…,0] is your real component, and x[…,1] is the imaginary one. For the case of real inputs, you should use something like this:
torch.stack((x, torch.zeros_like(x)), dim=-1)
The signal_ndim argument selects the 1D, 2D, or 3D fft. In the current torch.fft module, you can use fft, fft2, or fftn instead. This newer fft module also supports complex inputs, so there is no need to pass real and imaginary components as separate channels.