← all repositories
100/Cranium

Neural nets for machines that can't spare a dependency

A single-header C99 library that trains feedforward networks without dragging in Python, CMake, or your sanity.

603 stars C ML Frameworks
Cranium
Not currently ranked — collecting fresh signals.
star history

What it does

Cranium is a header-only feedforward neural network library in plain C99. Copy the src directory, #include "cranium.h", link -lm, and you have fully-connected networks with backprop, SGD variants, L2 regularization, and serialization. It targets embedded systems and restricted environments where installing dependencies is a non-starter.

The interesting bit

The BLAS integration is almost apologetically minimal: uncomment line 7 in matrix.h to swap in sgemm. No build system gymnastics, no feature flags — just a literal line comment. The whole API is raw C pointers and manual create/destroy calls, which feels archaic until you remember where this is meant to run.

Key highlights

  • Header-only: drop-in src folder, no build configuration
  • Supports sigmoid, ReLU, tanh, softmax, linear activations
  • Cross-entropy and MSE loss with batch/mini-batch/stochastic gradient descent
  • L2 regularization, momentum, learning rate annealing, fan-in initialization
  • Network serialization to disk (saveNetwork/readNetwork)
  • Optional CBLAS acceleration via single #define toggle

Caveats

  • Only feedforward architectures; no CNNs, RNNs, or attention
  • Manual memory management throughout (destroyNetwork, destroyDataSet)
  • Last meaningful commit activity appears to be years ago; Travis CI badge suggests legacy maintenance

Verdict

Grab this if you’re shipping inference on a microcontroller or maintaining legacy C codebases that need a neural net without the ecosystem tax. Skip it if you need modern architectures, automatic differentiation, or GPU acceleration — this is a deliberately narrow tool for narrow constraints.

Frequently asked

What is 100/Cranium?
A single-header C99 library that trains feedforward networks without dragging in Python, CMake, or your sanity.
Is Cranium open source?
Yes — 100/Cranium is open source, released under the MIT license.
What language is Cranium written in?
100/Cranium is primarily written in C.
How popular is Cranium?
100/Cranium has 603 stars on GitHub.
Where can I find Cranium?
100/Cranium is on GitHub at https://github.com/100/Cranium.

heatdrop uses Google Analytics to see which pages get read — nothing else. Your call. How we handle data.