Installation

Learn how to clone, build, and set up microgradpp on your machine.

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:

Bash
git clone https://github.com/gautam-sharma1/microgradpp.git
cd microgradpp

Create a Build Directory

Keep things tidy by building in a separate directory:

Bash
mkdir build
cd build

Configure with CMake

Pick the build configuration that works for you:

Bash
cmake ..

Builds the core library only.

Build the Project

Run make to compile everything:

Bash
make

Run the Example

Give it a quick spin to make sure everything works:

Bash
./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:

C++
#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:

Text
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