An educational project based on Andrej Karpathy's series, built from scratch to understand the mathematical foundations of neural networks and the logic of backpropagation.
Languages: Jupyter Notebook
A deep dive into the fundamental building blocks of Deep Learning, reconstructing the magic of PyTorch/TensorFlow sensor by sensor.
This repository documents my journey of understanding Neural Networks down to their atomic level. Inspired by Andrej Karpathy's lectures (micrograd, makemore), I have rebuilt the core mechanisms of deep learning frameworks from scratch.
Instead of simply using torch.Tensor, I created my own Sensor/Tensor engine that mimics the behavior of major libraries. This project is not just a clone; it is a comprehensive analysis and reimplementation of the mathematical foundations that power modern AI.
Clone the repository to start experimenting:
git clone [https://github.com/Decuayer/nn-scratch-andrej.git](https://github.com/Decuayer/nn-scratch-andrej.git)
cd nn-scratch-andrej
Install dependencies:
pip install -r requirements.txt
Here is a snippet showing how the custom engine handles operations and gradients:
from engine import Sensor # My custom implementation
# Initialize Sensors (similar to Tensors)
x = Sensor(2.0, label='input')
w = Sensor(-3.0, label='weight')
b = Sensor(6.88, label='bias')
# Forward Pass
out = x * w + b
out.tanh()
# Backward Pass (Autograd)
out.backward()
print(f"Output data: {out.data}")
print(f"Gradient w.r.t weight: {w.grad}")
The project is evolving. Upcoming milestones include:
Special thanks to Andrej Karpathy for his exceptional educational resources that paved the way for this project.
Decuayer