CppNet is a high-performance C++ deep learning library for building and training neural networks. It uses Eigen for fast tensor operations, OpenMP for CPU parallelism, and CUDA for GPU acceleration.
- 🚀 High Performance: Vectorized operations via Eigen and multi-threading with OpenMP.
- 🔧 GPU Acceleration: CUDA support for heavy computations.
- 🧩 Modular API: Clear separation of layers, losses, optimizers, metrics, and regularizations.
- 📦 Extensible: Easy to add custom layers, losses, or optimizers.
- 📊 Visualization: Tools for plotting training curves and inspecting models.
- 🧪 Examples Included: CNN, Linear, Transformer, and more.
CppNet/
├── CMakeLists.txt
├── examples/ # Example programs
│ ├── cnn_example.cpp # CNN example
│ ├── linear_example.cpp # Linear layer example
│ └── transformer_example.cpp # Transformer example
├── include/ # Public headers (library API)
│ ├── activations.hpp
│ ├── data.hpp
│ ├── layers.hpp
│ ├── losses.hpp
│ ├── metrics.hpp
│ ├── models.hpp
│ ├── optimizers.hpp
│ ├── regularization.hpp
│ ├── utils.hpp
│ └── visualization.hpp
├── src/ # Implementations
│ ├── activations.cpp
│ ├── data.cpp
│ ├── layers.cpp
│ ├── losses.cpp
│ ├── metrics.cpp
│ ├── models.cpp
│ ├── optimizers.cpp
│ ├── regularization.cpp
│ ├── utils.cpp
│ └── visualization.cpp
├── LICENSE
└── README.md
- C++17 or newer
- Eigen (header-only, auto-detected if installed)
- CMake ≥ 3.14
- (Optional) CUDA Toolkit for GPU acceleration
- (Optional) OpenMP for CPU parallelism
git clone https://github.com/LoqmanSamani/CppNet.git
cd CppNet
mkdir build && cd build
cmake ..
make -j$(nproc)
This will build the library and all example programs inside examples/
.
- Implement complete set of layers (CNN, RNN, Transformer, etc.)
- Add GPU backend (CUDA kernels for layers and ops)
- Add training utilities (Trainer, Callbacks, Checkpoints)
- Add more examples (GANs, Reinforcement Learning, NLP models)
Contributions are welcome!
Please follow consistent coding style (headers in include/
, implementations in src/
).
CppNet is released under the MIT License.