Parameter Count Calculator
Calculate the total number of parameters in a neural network architecture.
About Parameter Count Calculator
Parameter count varies by layer type. A dense (fully connected) layer has params = input × output + output, where the extra output term is the bias vector. A Conv2D layer has params = kernel_h × kernel_w × in_channels × out_channels + out_channels, since the same kernel is shared across all spatial positions. An LSTM layer has four gates (input, forget, output, cell), each acting like a dense layer over the concatenated input and hidden state, giving params = 4 × [hidden × (input + hidden)] + 4 × hidden.
Formulas
Dense layer
params = input_size * output_size + output_size
- input_size
- Number of input features
- output_size
- Number of output units (neurons)
Conv2D layer
params = kernel_h * kernel_w * in_channels * out_channels + out_channels
- kernel_h
- Kernel height
- kernel_w
- Kernel width
- in_channels
- Input channels
- out_channels
- Output channels (filters)
LSTM layer
params = 4 * (hidden * (input + hidden)) + 4 * hidden
- input
- Input dimension
- hidden
- Hidden state dimension
Worked example
With the default values below, Parameter Count Calculator returns Total Parameters of 131,328. Change any input above and every figure here is recalculated in your browser.
Inputs used
- Layer Typeone of Dense (Fully Connected), Conv2D, LSTM
- Dense (Fully Connected)
- Input Sizeaccepts 1–1,000,000
- 512
- Output Sizeaccepts 1–1,000,000
- 256
- Kernel Sizeaccepts 1–64
- 3
Results
- Total Parameters
- 131,328
- Weight Parameters
- 131,072
- Bias Parameters
- 256
Step by step
- 1Dense: (input × output) + output (bias)= 131,328
- 2Weight parameters vs. bias parameters= 131,328
Assumptions and limits
- The result is derived only from the 4 inputs listed above. Anything not among them is not part of the calculation.
- In particular, this calculator does not take inflation, tax, fees or charges or compounding frequency into account.
- Figures are rounded for display to whole numbers, so totals built from several rounded parts can differ slightly from the unrounded arithmetic.
How these calculators are built and tested is described on the Methodology page. If a figure looks wrong, please report it.
Frequently Asked Questions
Why does Conv2D have far fewer parameters than Dense for the same input/output size?
Convolutional layers share the same small kernel across every spatial location, so the parameter count depends only on kernel size and channel counts, not on the spatial dimensions of the input.
Why does LSTM have 4x more parameters than a similarly-sized dense layer?
An LSTM cell contains four internal gates (input, forget, output, and cell/candidate), each with its own weight matrix and bias, so its parameter count is roughly four times that of one dense transformation of the same size.
Does this include normalization layer parameters?
No, this calculates only the specified layer type. BatchNorm/LayerNorm add a small number of additional parameters (typically 2 × channels) not included here.
How do I estimate a full model's parameter count?
Sum the parameter counts of every layer in the architecture. For transformer models specifically, see the Transformer Parameters Calculator for a purpose-built formula.
Related Calculators
You might also need
- RNN Parameters CalculatorCommonly used together
- GRU Parameters CalculatorCommonly used together
- LSTM Parameters CalculatorCommonly used together
- Trainable Parameters CalculatorCommonly used together
- Embedding Layer Size CalculatorCommonly used together
- Transformer Parameters CalculatorCommonly used together
