Artificial intelligence · University
Neural layers, activations and parameter counts
A dense layer computes z=Wx+b followed by an activation. Dimensions must agree; each output has its own weighted combination.
Prerequisites
Vectors, matrix multiplication and functions.
Study notes
Layer
A dense layer computes z=Wx+b followed by an activation. Dimensions must agree; each output has its own weighted combination.
Nonlinearity
Nonlinear activations allow compositions that are not just one affine map. Stacking affine layers alone collapses to another affine map.
Parameters
For d inputs and h outputs, a dense layer with one bias per output has dh+h parameters.
ReLU
ReLU(z)=max(0,z). It is piecewise linear and nondifferentiable at zero; implementations choose a convention there.
Worked examples
A dense layer has 3 inputs and 4 outputs with one bias per output. Count parameters.
3×4+4=16.
16
Find ReLU(−2).
max(0,−2)=0.
0
Check your understanding
For weights (2,−1), input (3,4) and bias 1, find the preactivation.
What happens if several affine layers are stacked with no nonlinear activation?
- Their composition is another affine map
- They necessarily output zero
- They automatically become any possible function
- They have no parameters
Which dimensions must match in Wx?
- The rows of W and word count
- Nothing ever
- Only the file sizes
- The columns of W and entries of x
Why does a larger parameter count not guarantee better generalization?
Answers and marking guidance
Answers and marking notes
- 3
2×3−1×4+1=3.
- Their composition is another affine map
Affine compositions remain affine.
- The columns of W and entries of x
Matrix multiplication requires compatible inner dimensions.
- Capacity, data quality, regularization, optimization and task structure all matter. More parameters alone do not establish unseen-data performance.
Credit multiple relevant factors and evaluation.
Further reading and review references
These are reference links, not copied exercises, institutional endorsement or proof of independent review.
AI-assisted preview; independent educational review required. Level labels describe prerequisites, not accreditation or official curriculum alignment.