I’m trying to understand how nn.Conv2d is implemented.
As described by the example in Extending PyTorch — PyTorch 1.10.0 documentation, implementing a custom linear layer from absolute scratch means that we need to first implement a custom linear function from scratch that has properly defined forward and backward static methods.
After reading the source code of nn.Conv2d (which is amazingly short), I find that it also relies on a function called F.conv2d, which does ALL the heavy lifting. I can’t find the code for this function, but I’ve found my answer here:
So, my question is:
Does F.conv2d define both forward and backward code in a lower-level language? If so, which file is it? The path provided in the link above has changed.