Configure the convolution
CNN stride formulas
The effective kernel includes dilation spacing. Padding extends the input before movement. Stride controls each kernel step.
EffectiveKernel = Dilation × (Kernel − 1) + 1Output = floor((Input + PaddingBefore + PaddingAfter − EffectiveKernel) / Stride) + 1Same output = ceil(Input / Stride)Calculate stride effects
Enter the input tensor dimensions first. Choose kernels, padding, stride, dilation, and filters. Press calculate to review results.
Select reverse mode for target dimensions. Use multi-layer mode for complete networks. Review warnings before using settings.
Common CNN stride configurations
| Use case | Input | Kernel | Stride | Padding | Typical output |
|---|---|---|---|---|---|
| Feature preservation | 32×32×3 | 3×3 | 1×1 | Same | 32×32×filters |
| Spatial downsampling | 32×32×3 | 3×3 | 2×2 | Same | 16×16×filters |
| Valid convolution | 28×28×1 | 5×5 | 1×1 | Valid | 24×24×filters |
| Dilated convolution | 64×64×32 | 3×3 | 1×1 | Same | 64×64×filters |
Understanding CNN stride
Stride defines movement between kernel positions. Larger strides shrink feature maps faster. Smaller strides preserve spatial detail.
Stride two often replaces pooling layers. It learns downsampling through trainable filters. Pooling uses fixed aggregation rules.
Dilation expands the effective kernel footprint. It does not directly reduce output size. Stride and dilation solve different problems.
Same padding targets predictable output dimensions. Valid padding adds no boundary values. Custom padding supports asymmetric designs.
High strides reduce computation and memory. They can discard useful local information. Compare accuracy needs before aggressive downsampling.
CNN stride questions
What does stride mean in a CNN?
Stride is the number of input positions moved between kernel applications. A stride of two skips every other starting position.
How does stride affect output size?
Larger strides produce fewer kernel placements. This reduces output height, output width, memory, and computational work.
What is the difference between stride and dilation?
Stride changes movement between placements. Dilation changes spacing inside the kernel. Both affect receptive coverage differently.
Why can output dimensions be fractional?
The raw formula may not divide evenly. Standard convolution floors the result. Some edge positions then remain uncovered.
What does Same padding do?
Same padding chooses padding for predictable outputs. With stride one, spatial dimensions stay unchanged. Larger strides use ceiling division.
Can horizontal and vertical strides differ?
Yes. Asymmetric strides are valid in many frameworks. They downsample one spatial direction more aggressively.
How are CNN FLOPs estimated?
The calculator counts multiply-accumulate operations. Each MAC is approximated as two floating-point operations. Framework conventions may differ.
What is effective stride across layers?
Effective stride multiplies layer strides together. It shows the input-space jump between adjacent final output units.
When should stride two be used?
Stride two is common for controlled downsampling. Use it when lower resolution is acceptable. Validate information loss experimentally.