fkodom / fft-conv-pytorch

Implementation of 1D, 2D, and 3D FFT convolutions in PyTorch. Much faster than direct convolutions for large kernel sizes.
MIT License
474 stars 58 forks source link

Stride #2

Closed fshamsafar closed 3 years ago

fshamsafar commented 3 years ago

Thank you for this code. How can I specify the stride just like a normal conv layer? Thanks.

fkodom commented 3 years ago

Just added this feature. You can now specify stride just like in a normal conv layer. Ex:

conv_layer = FFTConv1d(16, 32, 3, stride=2)

Note: You won't see any speed-ups from using stride > 1 with Fourier convolutions. We can't compute the striding in Fourier space, so it's just applied at the end, after computing the inverse Fourier transform. Runtime should be almost identical for different stride values.