Configure the convolution layer
Sample convolution scenarios
| Case | Input | Kernel | Stride | Padding | Dilation | Mode | Output |
|---|---|---|---|---|---|---|---|
| Image feature map | 224 × 224 | 3 × 3 | 1 × 1 | 1 × 1 | 1 × 1 | Standard | 224 × 224 |
| Downsampling block | 32 × 32 | 5 × 5 | 2 × 2 | Valid | 1 × 1 | Standard | 14 × 14 |
| Volume processing | 64 × 64 × 64 | 3 × 3 × 3 | 2 × 2 × 2 | 1 × 1 × 1 | 1 × 1 × 1 | Standard | 32 × 32 × 32 |
| Learned upsampling | 28 × 28 | 4 × 4 | 2 × 2 | 1 × 1 | 1 × 1 | Transposed | 56 × 56 |
Core equations behind the calculator
Effective kernel per axis: effective_kernel = dilation × (kernel - 1) + 1
Standard convolution: output = floor(((input + pad_before + pad_after - effective_kernel) / stride) + 1)
Transposed convolution: output = ((input - 1) × stride) - pad_before - pad_after + effective_kernel + output_padding
Same padding for standard convolution: output = ceil(input / stride), then total padding is solved from the target output.
Parameter count: kernel_volume × input_channels × output_channels + bias_terms
MACs per sample: output_spatial_volume × output_channels × kernel_volume × input_channels
Steps for accurate CNN sizing
- Select 1D, 2D, or 3D based on the layer’s spatial axes.
- Choose standard convolution for shrinking or preserving size, or transposed convolution for learned upsampling.
- Enter input dimensions, channel counts, kernel sizes, stride values, and dilation values.
- Pick a padding mode. Use custom for manual control, valid for no padding, or same for shape-preserving standard layers.
- Enter output padding only when using transposed convolution.
- Press Calculate output size to show the result above the form.
- Review the tensor summary, axis table, and graph before implementing the layer in code.
- Use the CSV and PDF buttons to save your result for documentation or model review.
Common questions
1. What does dilation change in convolution sizing?
Dilation expands the effective kernel without adding learnable weights. A larger dilation increases spacing between kernel elements, which usually reduces standard-convolution output size unless padding also increases.
2. Why can the output become zero or negative?
This happens when the input is too small relative to the effective kernel, stride, and padding setup. The calculator warns you when the configuration is not physically usable.
3. When should I use same padding?
Use same padding when you want a standard convolution to preserve spatial size at stride 1, or to follow ceil-based output sizing when stride is larger.
4. How is transposed convolution different here?
Transposed convolution reverses the spatial shrinking effect and can increase output size. It also allows output padding, which fine-tunes the final dimension after stride-based expansion.
5. Does this calculator work for 1D, 2D, and 3D layers?
Yes. It activates width only for 1D, height and width for 2D, and depth, height, and width for 3D. The same axis-wise formulas are applied consistently.
6. What are effective kernel and kernel volume?
Effective kernel includes dilation, while kernel volume multiplies the raw kernel lengths across active axes. Effective kernel affects output size, while kernel volume affects parameters and MAC estimates.
7. Why do I see MACs instead of FLOPs?
MACs are commonly used for neural-layer cost estimates because each multiply-accumulate pair represents one core operation unit. Many model reports can convert MACs to FLOPs later if needed.
8. Can I use this for framework verification?
Yes. It is useful for checking layer shapes before implementation in deep learning frameworks, reviewing architecture diagrams, and validating tensor transitions during model design.