StudyBrixFree worksheets, study guides and courses

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.

Make a worksheet

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

  1. For weights (2,−1), input (3,4) and bias 1, find the preactivation.

  2. What happens if several affine layers are stacked with no nonlinear activation?

    1. Their composition is another affine map
    2. They necessarily output zero
    3. They automatically become any possible function
    4. They have no parameters
  3. Which dimensions must match in Wx?

    1. The rows of W and word count
    2. Nothing ever
    3. Only the file sizes
    4. The columns of W and entries of x
  4. Why does a larger parameter count not guarantee better generalization?

Answers and marking guidance

Answers and marking notes
  1. 3

    2×3−1×4+1=3.

  2. Their composition is another affine map

    Affine compositions remain affine.

  3. The columns of W and entries of x

    Matrix multiplication requires compatible inner dimensions.

  4. 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.