Hello folks,
According to my understanding, a convolution operation requires, for a kernel of size k, input batch of size B, input channels c, output channels f, image size n by n.
$$B * f * c * k^2 * n^2$$
The convolution can also be done on the fft domain by a element wise multiplication. Disregarding the cost of the FFT operations, for simplicity, we would have (note each complex multiplication requires 4 real ones)
$$
4 * B * f * c * n^2
$$
ps.: don’t know why formulas in markdown here are not working
This plot show that using FFT should be faster, even when I add the cost for the FFT operations themselves.

Analysis_Operations4767×3024 299 KB

However, when I tested it, see Gist 15 the time used for the multiplication operations is away longer than anything else.
Also, I had to be very careful, anything change could easily cause allocation error due to insufficient memory on GPU.
Can anyone give me a hint on how Con2d is faster than the FFT version? It suppose to be the other way around.