How to understand PyTorch's source code

These two posts will help get through the code structure and build system:

http://pytorch.org/2017/05/11/Internals.html

http://pytorch.org/2017/06/27/Internals2.html

It doesn’t touch the autograd system though.
The autograd system is moved into C now, and is multi-threaded, so stepping through the python debugger is probably a bit pointless.

Here’s a pointer to very old source code, where all the logic was in Python, in the early days of PyTorch. The logic is largely the same still, but moved into C.


9 Likes