I wrapped my functions calls inside a torch.nn.Module, and used jit
I know that my code 33 is really messy, didn’t have still time to make it more readable neither better written. But, hopefully, is good enough to see that the timers are still in favor of the traditional Conv2d.




Conv2d
Conv2dFFT
Conv2dFFT (without JIT)




0.2027
0.8736
2.9177



I am using jit like this, not sure how to use fuser as you mentioned.
class Conv2d(torch.nn.Module):
  def forward(self, x, filters):
    return torch.nn.functional.conv2d(x, filters, padding=2)

a = torch.rand(128, 64, 32, 32).cuda()
conv2d_spatial = Conv2d()
conv2d_spatial_opt = torch.jit.trace(conv2d_spatial, (a, filters)

...
.
.
.
...

class Conv2dFFT(torch.nn.Module):
  def forward(self, x, h):
    return fft_conv(x, h)

conv2d_fft = Conv2dFFT()
conv2d_fft_opt = torch.jit.trace(conv2d_fft, (a, filters))