100/Cranium
Free🤖 A portable, header-only, artificial neural network library written in C99
About 100/Cranium
Cranium is a portable, header-only feedforward artificial neural network library written in vanilla C99. It supports fully-connected networks of arbitrary depth and structure, using matrix-based calculations for performance. Designed for low-resource machines or environments where additional dependencies cannot be installed, Cranium includes activation functions (sigmoid, ReLU, tanh, softmax, linear), loss functions (cross-entropy, mean squared error), and optimization algorithms (batch gradient descent, stochastic gradient descent, mini-batch SGD, L2 regularization, learning rate annealing, momentum, fan-in weight initialization). It optionally integrates with CBLAS for fast matrix multiplication and supports serializable networks. The library is header-only: simply copy the src directory, include 'cranium.h', and compile with -lm.
Key Features
Pros & Cons
- Lightweight and portable – no external dependencies beyond standard C libraries
- Header-only library simplifies integration into C projects
- Supports essential activation and loss functions for basic neural network tasks
- CBLAS integration provides optional performance boost for matrix operations
- Well-suited for low-power or embedded environments where larger frameworks are impractical
- Limited to fully-connected feedforward architectures – no support for convolutional, recurrent, or attention layers
- No built-in GPU acceleration (CPU-only, though CBLAS can improve performance)
- Relatively basic compared to modern deep learning frameworks like TensorFlow or PyTorch
- Documentation is minimal (primarily README and header comments)