Summary of FFT APIs
See original GitHub issueThis issue gathers all the information of the current APIs in NumPy, CuPy, Dask, JAX, MXNet, pytorch and tensorflow in the FFT module. The main outcome of this issue is to open the discussion of the potential APIs that are going to be included in the spec.
The current APIs involved in this issue are:
- Standard FFT: fft, ifft, fft2, ifft2, fftn, ifftn
- Real FFT: rfft, irfft, rfft2, irfft2, rfftn, irfftn
- Hermitian FFT: hfft, ihfft
- Helper Routines: fftfreq, rfftfreq, fftshift, ifftshift
Individual APIs
fft/ifft
argument/keyword | NumPy | CuPy | Dask | JAX | MXNet | Pytorch | TF |
---|---|---|---|---|---|---|---|
n | Y | Y | Y | Y | N | Y | N |
axis/dim | Y | Y | Y | Y | N | Y | N |
norm | Y | Y | N | Y | N | Y | N |
data | N | N | N | N | Y | N | N |
out | N | N | N | N | Y | N | N |
name | N | N | N | N | Y | N | Y |
fft2/ifft2
argument/keyword | NumPy | CuPy | Dask | JAX | Pytorch | TF |
---|---|---|---|---|---|---|
s | Y | Y | Y | Y | Y | N |
axes/dim | Y | Y | Y | Y | Y | N |
norm | Y | Y | N | Y | Y | N |
name | N | N | N | N | N | Y |
These functions are not implemented in MXNet.
fftn/ifftn
argument/keyword | NumPy | CuPy | Dask | JAX | Pytorch |
---|---|---|---|---|---|
n | Y | Y | N | N | Y |
s | N | N | Y | Y | N |
axis/axes/dim | Y | Y | Y | Y | Y |
norm | Y | Y | N | Y | Y |
These functions are not implemented in MXNet and TF.
rfft/irfft
argument/keyword | NumPy | CuPy | Dask | JAX | Pytorch | TF |
---|---|---|---|---|---|---|
n | Y | Y | Y | Y | Y | N |
axis/dim | Y | Y | Y | Y | Y | N |
norm | Y | Y | N | Y | Y | N |
fft_length | N | N | N | N | N | Y |
name | N | N | N | N | N | Y |
These functions are not implemented in MXNet.
rfft2/irfft2
argument/keyword | NumPy | CuPy | Dask | JAX | Pytorch | TF |
---|---|---|---|---|---|---|
s | Y | Y | Y | Y | Y | N |
axes/dim | Y | Y | Y | Y | Y | N |
norm | Y | Y | N | Y | Y | N |
fft_length | N | N | N | N | N | Y |
name | N | N | N | N | N | Y |
These functions are not implemented in MXNet.
rfftn/irfftn
argument/keyword | NumPy | CuPy | Dask | JAX | Pytorch |
---|---|---|---|---|---|
s | Y | Y | Y | Y | Y |
axes/dim | Y | Y | Y | Y | Y |
norm | Y | Y | N | Y | Y |
These functions are not implemented in MXNet and TF.
hfft/ihfft
argument/keyword | NumPy | CuPy | Dask | JAX | Pytorch |
---|---|---|---|---|---|
n | Y | Y | Y | Y | Y |
axis/dim | Y | Y | Y | Y | Y |
norm | Y | Y | N | Y | Y |
These functions are not implemented in MXNet and TF.
fftfreq/rfftfreq
argument/keyword | NumPy | CuPy | Dask | JAX | Pytorch |
---|---|---|---|---|---|
d | Y | Y | Y | Y | Y |
dtype | N | N | N | N | Y |
device | N | N | N | N | Y |
requires_grad | N | N | N | N | Y |
layout | N | N | N | N | Y |
These functions are not implemented in MXNet and TF.
fftshift/ifftshift
argument/keyword | NumPy | CuPy | Dask | JAX | Pytorch |
---|---|---|---|---|---|
axes/dim | Y | Y | Y | Y | Y |
These functions are not implemented in MXNet and TF.
Summary
- Most FFT APIs have the following keyword arguments:
n
,axis
,norm
, with the exception of TF and MXNet. - The equivalent to the
axis
keyword in NumPy, CuPy, Dask and Jax isdim
in Pytorch. fft2
can have the same implementation offftn
if called with the correct arguments.fft3D
is only implemented in TF .- The output for the inverse functions return a complex array in NumPy.
- The arguments of the functions are the same for calculating the FFT and its inverse.
- There’s a mix between the use of
axis
,axes
even among functions in the same library.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:6
- Comments:12 (11 by maintainers)
Top Results From Across the Web
Fast Fourier Transforms | Apple Developer Documentation
Where possible, use discrete Fourier transforms (DFTs) instead of fast Fourier transforms (FFTs). DFTs provide a convenient API that offers greater flexibility ......
Read more >Guide to FFT Analysis (Fast Fourier Transform) - Dewesoft
This is the ultimate guide to FFT analysis. Learn what FFT is, how to use it, the equipment needed, and what are some...
Read more >Fast Fourier transform - Wikipedia
A fast Fourier transform (FFT) is an algorithm that computes the discrete Fourier transform (DFT) of a sequence, or its inverse (IDFT). Fourier...
Read more >FFT - L3HarrisGeospatial.com
The FFT function returns a result equal to the complex, discrete Fourier transform of Array. The result of this function is a single-...
Read more >FFT - Compartmental
FFT stands for Fast Fourier Transform. It is an efficient way to calculate the Complex Discrete Fourier Transform. There is not much to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I checked in a few libraries (SciPy, cuCIM, scikit-image, scikit-learn, matplotlib) that 2D transforms (
fft2
/ifft2
/rfft2
/irfft2
) are rarely used. At most one or two places in each codebase. I believe it is fine to not include them in the standard. Perhaps they were there because in the early days libraries wanted to be compatible with Matlab? (My guess)It is of course possible to express 1-D transforms in terms of n-D, but I suspect that if we make everyone write
fftn(x, 1)
instead offft(x)
, they won’t be too happy. I thinkfft
is useful syntactic sugar, and it costs very little to support it.