Installation#
Let's get microgradpp up and running on your machine. Don't worry — it's pretty straightforward!
Prerequisites#
Before you dive in, make sure you have these installed:
- CMake — version 3.15 or higher
- C++ Compiler — with C++17 support (GCC, Clang, MSVC all work)
- OpenCV — optional, only needed for visualization features
Building from Source#
Clone the Repository
Grab the code from GitHub:
git clone https://github.com/gautam-sharma1/microgradpp.git
cd microgradppCreate a Build Directory
Keep things tidy by building in a separate directory:
mkdir build
cd buildConfigure with CMake
Pick the build configuration that works for you:
cmake ..Builds the core library only.
Build the Project
Run make to compile everything:
makeRun the Example
Give it a quick spin to make sure everything works:
./m++If you see output without errors, you're good to go! 🎉
Using as a Header-Only Library#
Prefer to skip the build step entirely? microgradpp also works as a header-only library. Just copy the include/ directory into your project and include the headers you need:
#include "microgradpp/Value.hpp"
#include "microgradpp/MLP.hpp"The header-only approach is great for quick experiments or when you want to integrate microgradpp into an existing project without touching your build system.
Project Structure#
Here's a quick look at how the repo is organized:
microgradpp/
├── include/ # Header files
├── examples/ # Example programs
├── tests/ # Unit tests
├── public/ # Images and assets
├── scripts/ # Utility scripts
├── CMakeLists.txt # CMake configuration
├── main.cpp # Main example
└── README.md