Here is the C source for PyTorch https://github.com/pytorch/pytorch/tree/master/torch/csrc 4.2k
And the external libraries that perform the math computation can be found in https://github.com/pytorch/pytorch/tree/master/torch/lib 1.2k