pytensor icon indicating copy to clipboard operation
pytensor copied to clipboard

Consider using fft for convolution to reduce cost of multiple convolutions with shared inputs

Open ricardoV94 opened this issue 9 months ago • 0 comments

Description

fft convolution is actually faster than direct convolution for large inputs. Scipy uses it for n>500 [citation needed]. But even if our inputs are not large, we may want to use it if we see the same inputs used in multiple places.

One useful but more involved case is the forward + grad of a convolution, where the reverse of the input is convolved with the output gradient. There seems to be a way to obtain the fft of the reversed input, for the fft of the input: https://dsp.stackexchange.com/questions/82725/recover-fourier-transform-of-flipped-signal-from-the-fft-of-orignal-signal

ricardoV94 avatar Mar 24 '25 14:03 ricardoV94