The neural network parameter count calculator gives the number of weights and biases, the memory and the operations per prediction of a fully connected network with up to two hidden layers.
How the calculation works
- Enter the input features, the neurons of the hidden layers and the output neurons.
- Pick the precision of the weights.
- The calculator gives the parameters, the weights, the biases, the share of the first layer, the memory and the operations.
Example
A network 784-128-64-10 has 784 × 128 + 128 × 64 + 64 × 10 = 109,184 weights and 128 + 64 + 10 = 202 biases, so 109,386 parameters. In 32-bit it takes 0.438 MB for inference and 1.750 MB to train with Adam. The first layer holds 91.9 % of the weights. One prediction costs about 218,368 operations.
Why it matters
The calculator helps students, hobbyists and engineers who size a small neural network, compare architectures or check that a model fits in the memory of a microcontroller or a phone.
Good to know
The counts are exact for a dense network with biases in every layer. Other layer types differ: convolutions share weights, so their counts do not depend on the image size, and attention layers have four projection matrices. Normalization layers add a few parameters per feature. A rule of thumb is to have more training examples than parameters, but deep networks often work well with more parameters than examples, as long as they are regularized. Quantizing the weights to 8 bits divides the memory by 4 with a small loss of accuracy in many models. The training memory shown excludes activations and the data pipeline, which can dominate for large batches.
Related tools
The convolution layer calculator counts convolution parameters, the embedding table calculator sizes vocabularies, the LLM memory calculator handles large language models and the linear regression calculator covers the simplest model.