Have you ever wondered 🤔 how PyTorch nn.Module
works?
I was always curious to understand how the internals work too. Recently I was reading Fast.ai's Deep learning for coders book's 19th chapter, where we learn how to build minimal versions of PyTorch
and FastAI
modules like
- Dataset, Dataloaders
- Modules
- FastAI Learner
This intrigued 🤔 me to take a look at the PyTorch
source code for nn.Module
. The code for nn.Module
is 1000+
lines 😮. After a few cups of coffee ☕☕, I was able to make sense of what is happening inside. Hopefully, by end of this post, you would have an understanding of what goes insidenn.Module
without those cups of coffee 😄.