It is well-known that convolution is (up to constants and conventions) the same as applying Fourier transform, a pointwise multiplication, and inverse Fourier transform. Since we will soon have a distributed FFT available in Heat (see #1097) it is time to think about how this can be exploited to implement convolution for DNDarrays of arbitrary dimensions and arbitrary kernel sizes.
Some first thoughts:
- the approach of convolution via FFT will be more efficient than traditional convolution only in the case of very large kernels (hats an exotic, but interesting use-case)
- "boundary conditions" have to be handeled via careful choice of padding
- see https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.fftconvolve.html#scipy.signal.fftconvolve for convolution-by-FFT in SciPy
- dealing with the "standard case" (zero-padding and no stride, as done in SciPy) seems to be rather straight-forward; including a stride (as in PyTorchs
convolve_...-functions) seems to require some additional work but in principal stil possible using the FFT-approach (?): it should suffice to implement and apply downsampling
It is well-known that convolution is (up to constants and conventions) the same as applying Fourier transform, a pointwise multiplication, and inverse Fourier transform. Since we will soon have a distributed FFT available in Heat (see #1097) it is time to think about how this can be exploited to implement convolution for DNDarrays of arbitrary dimensions and arbitrary kernel sizes.
Some first thoughts:
convolve_...-functions) seems to require some additional work but in principal stil possible using the FFT-approach (?): it should suffice to implement and apply downsampling