The convolution layer output size calculator gives the output size, the number of parameters, the multiply-accumulate operations and the memory of the output of a convolutional layer in a neural network.
How the calculation works
- Enter the input size, the kernel size, the padding, the stride and the dilation.
- Enter the number of input and output channels.
- The calculator gives the output size, the parameters, the multiply-accumulates, the output values and the output memory.
Example
A 3×3 convolution with padding 1 and stride 1 on a 224×224 image with 3 input and 64 output channels keeps the size at 224×224. It has 3 × 3 × 3 × 64 + 64 = 1,792 parameters and needs 86.7 million multiply-accumulates. The output has 3,211,264 values, or 12.85 MB in 32-bit floats.
Why it matters
The calculator helps machine learning students, engineers who design image models and anyone who needs to check the shape of tensors between layers.
Good to know
Deep learning frameworks use the same formula, and some round differently for the “same” padding with even kernels, so check the output shape of your library. A stride above 1 or a pooling layer reduces the size and the cost, at the price of resolution. Dilation widens the field of view without more parameters. Depthwise separable convolutions replace the K² × Cin × Cout term by K² × Cin + Cin × Cout, a reduction of about 8 to 9 times for 3×3 kernels with many channels. The memory shown is for one image and one layer: during training the activations of all layers are kept for the backward pass, and they are multiplied by the batch size.
Related tools
The receptive field calculator shows how much of the input a unit sees, the neural network parameter count calculator handles dense layers, the pixel density calculator relates images to screens and the LLM memory calculator sizes large models.