Specifically I want the source code for torch.mean(). I can’t seem to find it anywhere in the torch folder. Where is it?
Implementations are in the aten folder, here ReduceOps.cpp. The selective excursion blog post attempts to show you how things are tied together.
Note that reductions use a mechanism called TensorIterators that is one of the more elaborate things in PyTorch, so their actual implementation is spread across several files and is a bit less straightforward to understand than one might expect.