HN CompanionHN Companion new | best | ask | show | jobs
Show HN: Reimplementing PyTorch from scratch (MLP, CNN) to learn the internals (github.com/geyuxu)
2 points by geyuxu 9 hours ago | 1 comment


Hi HN, author here.

I'm a Java Architect turned AI MSc student. I found myself using `torch.nn.Linear` and `torch.nn.Conv2d` without fully grasping the tensor operations underneath.

So I started this project to rebuild these layers from first principles (using only Tensor operations and Autograd, no `nn.Module`).

Currently implemented: - Linear Regression & Logistic Regression (Numpy manual grad vs Autograd) - Multi-Layer Perceptrons (MLP) - Convolutional Neural Networks (CNN) with pooling

Coming next: - RNNs and Attention mechanisms (WIP)

The goal is education: stripping away the abstraction layers to see the math. Feedback on my CNN implementation is very welcome!