How gianpgunawan/neural_network works
This is a small C neural-network implementation with an example executable: it loads a predefined model, accepts two command-line inputs, runs inference, prints activations, and dumps model code. The library also contains backpropagation, matrix operations, arena allocation, and several activation functions. The example’s training loop is commented out. Relationships below follow shown calls and source-index references; bitmap.h’s role is unclear from the available evidence.
Main entry points: main.c Example entry point · nn.c Network and training · softmax.c Softmax · matrix_dyn.c Arena-backed matrices
Components 15
Example application
- Example entry point
main.c - Predefined model
model.h - Bitmap header
bitmap.h
Network runtime
- Network and training
includes/nn.c
Matrix operations
- Matrix operations
includes/matrices/matrix.c - Arena-backed matrices
includes/matrices/matrix_dyn.c
Memory and utilities
- Arena allocator
includes/arena.c - Dynamic array
includes/utils/dynamic_array.h - Container helper
includes/utils/container_of.h - Assertions
includes/utils/nn_assert.h
Activations
- Activation interface
includes/activations/activation.h - ReLU
includes/activations/relu.c - Sigmoid
includes/activations/sigmoid.c - Softmax
includes/activations/softmax.c
Other components
- CLI user
Connections 24
- CLI user → Example entry point: provides inputs
main.c - Example entry point → Predefined model: loads model
main.c - Example entry point → Arena allocator: initializes arena
main.c - Example entry point → Network and training: runs inference
main.c - Example entry point → Matrix operations: prints matrices
main.c - Example entry point → Sigmoid: initializes activation
main.c - Example entry point → ReLU: initializes activation
main.c - Example entry point → Softmax: initializes activation
main.c - Example entry point → Arena-backed matrices: allocates dataset
main.c - Predefined model → Network and training: adds layers
model.h - Predefined model → Arena-backed matrices: creates matrices
model.h - Network and training → Matrix operations: computes operations
includes/nn.c - Network and training → Arena-backed matrices: creates temporaries
includes/nn.c - Network and training → Activation interface: dispatches functions
includes/nn.c - Network and training → Dynamic array: stores layers
includes/nn.c - Arena-backed matrices → Arena allocator: allocates buffers
includes/matrices/matrix_dyn.c - Arena-backed matrices → Matrix operations: performs operations
includes/matrices/matrix_dyn.c - Matrix operations → Assertions: checks dimensions
includes/matrices/matrix.c - ReLU → Activation interface: implements interface
includes/activations/relu.c - Sigmoid → Activation interface: implements interface
includes/activations/sigmoid.c - Softmax → Activation interface: implements interface
includes/activations/softmax.c - Softmax → Dynamic array: reads final layer
includes/activations/softmax.c - Softmax → Matrix operations: reads logits
includes/activations/softmax.c - Softmax → Network and training: reads model layers
includes/activations/softmax.c