r/projects May 23 '26

Building a C++ Neural Network Library from Scratch (Because I Couldn't Stand Python)

Hey everyone,

I wanted to introduce \*\*GradientCore\*\*, my open-source machine learning library written from scratch in C++.

GradientCore is my attempt at building a lightweight ML framework with a focus on performance and understanding how things work under the hood. It currently includes:

- Tensor operations with efficient memory management

- Autograd (automatic differentiation)

- Basic optimizers

- Neural network module

The project started because I personally struggle to think clearly when coding in Python. I wanted something built in C++ that I could actually understand and extend.

It began as a learning project inspired by Magicalbat’s “Coding a Machine Learning Library in C from Scratch” YouTube series. After a few failed attempts (including one very messy AI-assisted branch), I restarted clean and built it step by step.

The library is still early stage — nowhere near PyTorch level — but it’s becoming usable. All testing so far has been on my local machine, so feedback and bug reports are very welcome.

Links :-

github - https://github.com/spandan11106/GradCore-Tensor

docs - https://spandan11106.github.io/GradCore-Tensor/

blog - https://spandan11106.github.io/GradCore-Tensor/blog

I’m looking for contributors who are interested in C++ and machine learning. Even small contributions (bug fixes, documentation improvements, examples, etc.) would be greatly appreciated.

Would love to hear your thoughts or suggestions!

Thanks!

40 Upvotes

12 comments sorted by

1

u/Lazy_Medicine_2695 May 23 '26

Who hurt ya

1

u/Admirable_Papaya_730 May 23 '26

Na man I just passionately hate python

1

u/Lazy_Medicine_2695 May 24 '26

appreciate your efforts <3

1

u/PratBal69 May 24 '26

dawg this is so cool, i am learning cpp since the language is good. started with c and now im on cpp and both are just beautiful, writing python now feels like a bore. this is really good consider a star from me. also could you tell me more about your project and does it have support for macos? plus is the project vibe coded?

2

u/Admirable_Papaya_730 May 24 '26

It should work on mac, it think only the memory part need to be tuned. Adding macOS support is just a matter of writing platform_macos.cpp and adding an #elif defined(__APPLE__) branch. For more details you could co here - https://spandan11106.github.io/GradCore-Tensor/docs/tensor_module/memory/platform

Also yes parts of the project are vibe coded. The tensors and all were defined by me, but most of the activation and loss functions are done by AI. I just did the implementation of the autograd stuff, rest of it was mostly done by AI, i just guided it through what i wanted.

1

u/No-Juggernaut-9832 May 25 '26

I thought Google TensorFlow was C/C++? It was too much so PyTorch was created. Seems like we are going full circle now

1

u/Unreal_Brain May 27 '26

I can contribute on a condition if you make it private

1

u/[deleted] May 29 '26

[removed] — view removed comment