Everyday Tools

Softmax, Activations and Conv Layer Shapes: A Hands-On Guide

Work through softmax with temperature, common activation functions, convolution output sizes, layer parameter counts and feature scaling with examples.

Saizul Amin
Saizul Amin30 Oct 2026 · 3 min read
Softmax, Activations and Conv Layer Shapes: A Hands-On Guide

Softmax, Activations and Conv Layer Shapes: A Hands-On Guide

Some neural-network questions do not need a notebook, just a quick, correct number. What does temperature 0.7 do to these logits? Why does my conv layer output 55 pixels instead of 56? How big is this network? The neural network calculator has a mode for each; this guide shows the reasoning.

Softmax and temperature

Softmax turns a list of scores into probabilities that sum to 1. Each score is exponentiated after dividing by the temperature, then normalised. For logits 2.0, 1.0, 0.1 and −1.2 at temperature 1 the top option gets about 64%. Halve the temperature and it climbs to about 86%; double it and it drops to about 46%.

Language models sample their next token from exactly this distribution. A low temperature gives focused, repeatable answers; a higher one gives variety at the cost of more mistakes. The entropy figure in the tool, measured in bits, puts a number on how spread out the choice is.

Activation functions side by side

  • Sigmoid squashes any value into 0 to 1; useful for binary outputs, but gradients vanish for large inputs.
  • Tanh is centred on zero with range −1 to 1.
  • ReLU passes positives and zeroes negatives; cheap and the long-time default.
  • Leaky ReLU keeps a small slope for negatives so units never die completely.
  • GELU is a smooth curve close to ReLU, standard in transformers.

The table evaluates all five for each value you enter, which helps when checking a hand calculation or explaining the differences to students.

Convolution output size

The output width of a convolution is floor((W + 2P − K) ÷ S) + 1. Some common cases:

  • 224 input, 3×3 kernel, padding 1, stride 1 → 224 (shape preserved).
  • Same with stride 2 → 112.
  • 32 input, 5×5 kernel, no padding → 28.

The floor explains most surprises: odd sizes lose a pixel when halved, and several such layers can leave you one pixel short of the size a later layer expects.

Counting parameters

A convolution has (K × K × input channels + 1) × output channels weights, the +1 being the bias. A dense layer from n to m units has (n + 1) × m. The classic 784-256-128-10 network for handwritten digits has 235,146 parameters, under 1 MB at 32-bit. Enter your own layer sizes, separated by commas, to total any multilayer perceptron.

Scaling features

Models train better when inputs share similar ranges. Min-max scaling maps the smallest value to your chosen minimum and the largest to the maximum. Standardisation subtracts the mean and divides by the standard deviation. Remember to compute these statistics on training data only, then apply the same numbers to validation and test sets.

A quick design checklist

Before training a new convolutional network, write down the input size, then for each layer the kernel, stride, padding and channels. Use the convolution mode to confirm each output shape and the parameter mode to total the dense head. If the final feature map is not the size you expect, the culprit is almost always a stride-2 layer acting on an odd size or a missing padding value. Catching that on paper takes a minute; finding it from a framework error message can take much longer.

A note on dropout

With dropout rate p, surviving units are multiplied by 1 ÷ (1 − p) during training. At p = 0.2 that is 1.25. This keeps the expected activation the same, so nothing needs changing at inference time.

These calculations follow textbook definitions; frameworks add options such as dilation and grouping, so confirm shapes against your library's documentation.

Completely freeNo cost, no sign-up
Files stay privateEverything runs in your browser
Easy in your languageAvailable in many languages