FFT returns different values compare with FFTW

Hello everyone,

I am trying to use FFT for my project, my original code is written by C++ and I want to change it to Pytorch. I met the problem that the values after transformation are different compare with FFTW. .
Example:
tensor([[0, 1], [2, 3], [4, 5], [6, 7]]
FFT: tensor(
[[28.+0.j, -4.+0.j],
[-8.+8.j, 0.+0.j],
[-8.+0.j, 0.+0.j],
[-8.-8.j, 0.+0.j]])

FFTW: [[12.000000 + 16.000000j], [-4.000000 -4.000000j], [14.000000 -6.000000j], [-4.000000 + 0.000000j], [-8.000000 -8.000000j], [0.000000 + 0.000000j], [-10.000000 + 14.000000j], [0.000000 -4.000000j]].

Any idea what might have caused the issue and how to fix it?

1 Like