Deep Learning · TEE · section
Model answer: shape, activations and parameters
Convolutional neural networks
Question
Question. Distinguish a CNN layer's output shape, number of output activations and number of trainable parameters. Explain the formulas used to calculate them.
Answer — step by step
Output shape tells how the produced values are arranged. The activation count tells how many values were produced for one input. Parameter count tells how many learned weights and biases define the layer. These are three different questions.
Spatial output shape
For an ordinary convolution with dilation 1:
N_{\mathrm{out}}=\left\lfloor\frac{N+2P-K}{S}\right\rfloor+1N is the incoming spatial size, P is padding on each side, K is kernel size and S is stride. Apply the rule independently to height and width. The number of output channels is the number of filters.
Output activations
A=H_{\mathrm{out}}W_{\mathrm{out}}C_{\mathrm{out}}This is the number of output values for one example, excluding any batch dimension.
Trainable parameters
P_{\mathrm{conv}}=(K_hK_wC_{\mathrm{in}}+1)C_{\mathrm{out}}Each filter spans every incoming channel. The +1 is one bias per filter. Remove it if biases are disabled. Spatial output dimensions do not appear here because filters share their weights across positions.
Small example
A 7 × 7 × 3 input, two 3 × 3 filters, stride 2 and padding 1 gives output 4 × 4 × 2. It contains 32 activations but has (3 × 3 × 3 + 1) × 2 = 56 parameters. These counts do not need to match. In a multilayer question, the current layer's output channels become the next convolution's input channels.