pymc-devs / pymc-devs/pytensor
Consider using fft for convolution to reduce cost of multiple convolutions with shared inputs
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 644
- Forks
- 208
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 16
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names no files or tests. Start by locating the convolution implementation and its forward and gradient paths, then compare the direct and FFT approaches for repeated inputs and large inputs. Done means an agreed implementation scope with benchmarks or tests showing whether shared-input convolutions reduce cost.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- performance
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100