Closed phudtran closed 3 months ago
Some more background, my application is running the spectrogram through an ONNX model (trained with PyTorch) then reconstructing the signal with the ISTFT. Since RustFFT's IFFT is not equivalent to PyTorch's IFFT, the signal is not reconstructed correctly.
Reopening after fixing tests. Feel free to close if this is not planned.
I didn't normalize after the ISTFT. Didn't match PyTorch's behavior before. Fixed now.
Testing with signal size: 1024
Average Rust roundtrip difference: 1.0426809562242775e-16
Average PyTorch roundtrip difference: 1.0637285391174207e-16
Average roundtrip difference (Rust FFT -> PyTorch IFFT): 1.0524879883908826e-16
Average roundtrip difference (PyTorch FFT -> Rust IFFT): 1.0640585855053184e-16
Testing with signal size: 4096
Average Rust roundtrip difference: 1.1929012237158682e-16
Average PyTorch roundtrip difference: 1.2068799818214623e-16
Average roundtrip difference (Rust FFT -> PyTorch IFFT): 1.2049052833236164e-16
Average roundtrip difference (PyTorch FFT -> Rust IFFT): 1.2169140730809795e-16
Testing with signal size: 16384
Average Rust roundtrip difference: 1.2780922228069706e-16
Average PyTorch roundtrip difference: 1.3177517016782907e-16
Average roundtrip difference (Rust FFT -> PyTorch IFFT): 1.3015744457352966e-16
Average roundtrip difference (PyTorch FFT -> Rust IFFT): 1.3157975132891694e-16
Hi,
In my attempt to implement STFT and ISTFT, I noticed a difference between the output of RustFFT vs PyTorch.
The code to run the test can be found here. https://github.com/phudtran/rustfft_vs_torch
The results for convenience.