kann
FreeA lightweight C library for artificial neural networks.
About kann
KANN is a standalone and lightweight C library for constructing and training small to medium artificial neural networks. It supports multi-layer perceptrons (MLP), convolutional neural networks (CNN), and recurrent neural networks (RNN) including LSTM and GRU. The library implements graph-based reverse-mode automatic differentiation, enabling topologically complex networks with recurrence, shared weights, and multiple inputs/outputs/costs. With less than 4000 lines of code and no non-standard dependencies, it is portable and compatible with ANSI C compilers. It features optimized matrix products and convolution, mini-batching support, and effective multi-threading for CPU execution. KANN is intended for experimenting with small to medium neural networks in C/C++, deploying models without dependency issues, or learning deep learning internals.
Key Features
Pros & Cons
- Very small and lightweight codebase
- No external dependencies (only standard C library)
- Flexible computational graph construction
- Efficient CPU-only execution with mini-batching and multi-threading
- Supports advanced architectures like RNN, LSTM, GRU
- Portable across ANSI C compilers
- CPU only, not intended for training huge neural networks
- Lacks batch normalization and some common operators
- Verbose APIs for training RNNs