Skip to content
Omnikalc

Convolution layer output size calculator

Enter the input size, the kernel, the padding, the stride, the dilation and the channels to get the output size, the number of parameters, the multiply-accumulate operations and the memory of the output.

Updated on
Your inputs
px

Value out of range

Value out of range

Value out of range

Value out of range

Value out of range

Value out of range

Value out of range

Results

Output width and height

224 px

Parameters (weights and biases)
1,792
Multiply-accumulates per image (millions)
86.7
Values in the output feature map
3,211,264
Memory of the output (32-bit)
12.85 MB
Effective kernel size with dilation
3

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.

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.

Frequently asked questions

What is the formula for the output size?

The output width is ⌊(W + 2P − D × (K − 1) − 1) / S⌋ + 1, where W is the input width, P the padding, K the kernel size, S the stride and D the dilation. With K = 3, P = 1 and S = 1 the size is unchanged, which is the usual same padding.

How are the parameters counted?

Each output channel has one kernel of K × K × input channels weights, plus one bias. So the layer has K² × Cin × Cout + Cout parameters, regardless of the image size. This weight sharing is why convolutions need far fewer parameters than dense layers.

What do the operations tell me?

Each output value needs K² × Cin multiply-accumulates, so the cost is output pixels × K² × Cin × Cout. Doubling the stride cuts it by about four. One multiply-accumulate counts as two floating-point operations in most conventions.

Was this calculator helpful?

Thanks for your feedback!

Results are estimates provided for information purposes. They do not replace professional advice.