Comment

Comment by apexkid

Wanted to share a side project I recently wrapped up after stumbling across [Karpathy's micrograd](https://github.com/karpathy/micrograd).

ML is mostly Python territory these days, and for good reason—it’s simple, flexible, and gets the job done. But as someone who spends most of their time in C++, I thought: What if I tried building something ML-related in C++? Sure, I had an idea of the challenges — verbose syntax, manual memory management, and, let’s face it, a lot less “fun” compared to Python—but I wanted to see what it’s really like.

So, inspired by micrograd, I decided to build my own autograd library in C++ from scratch. This wasn’t about translating Karpathy’s code (I’ve barely read it, honestly). My goal was to understand the inner workings of Autograd and Computational graphs, like the ones used in PyTorch, and recreate those ideas in C++.

The result? A small library that can train simple neural networks for tasks like linear and logistic regression.

It’s been a wild ride—balancing the elegance of ML concepts with the quirks (and occasional frustrations) of C++.

If you’ve ever wondered what it’s like to tackle ML with C++, or just enjoy geeking out over low-level implementations, I’d love to hear your thoughts. Code and project details are here: https://github.com/apexkid/micrograd-cpp.

parent apexkid 1 year ago

No comments yet

Be the first to share your thoughts.

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton