Source code for conv2d

Can someone point to the cpp code for conv2d. I would like to know how pytorch implements convolution internally.

I need to run convolution for inputs that differ very slightly(with the same kernel) and I hope that understanding how conv2d works internally will give me ideas on how to compute the many convolutions efficiently (for example by storing common computations).

Thank You!


We try to use highly efficient libraries such as cudnn or mkldnn as much as possible. So in practice, their code is most likely to be the one that runs when you call conv.

The general implementation we have that works in all cases can be found there: for gpu and for cpu.