Where is torch._C._nn.avg_pool2d?

I find the fold torch/csrc/nn is empty.
I cant find it.

These are native ATen functions, designated as nn functions (to not pollute the torch.xx namespace but have them nicely accessible from C++, too).
The specific function is defined in LegacyNNDefinitions.cpp and calls the TH(Cu)NN function (living in aten/src/TH(CU)NN and automatically wrapped).
I wrote a bit about how ATen functions are put into PyTorch in my selective excursion into PyTorch internals blog post. torch._C.nn wasn’t a thing then, but it certainly is much nicer than the old Python-level backend mechanism. The designation torch._C.x vs. torch._C.nn.x is done in in ATen in native_functions.yaml.

Best regards

Thomas