A multilayer perceptron takes 10-dimensional inputs, passes them through two hidden layers of widths 32 and 16 (each with biases), and outputs 4 class scores (logits). How many learnable parameters does it have?

Deep learning, Multilayer perceptrons
Level L1 Beginner. Length One-liner. Nature Mat Mathematical.

What's being asked

Whether you can count weights and biases in a fully connected network from layer widths.

Key idea

A dense layer from nin inputs to nout outputs with biases has ninnout+nout=(nin+1)nout parameters; summing across the three layers gives 352+528+68=948.

Steps

  1. Apply (nin+1)nout per layer (one weight per input–output pair plus one bias per output unit; activations add zero parameters).
  2. Compute each layer: layer 1 (10→32) has 11×32=352, layer 2 (32→16) has 33×16=528, and the output layer (16→4) has 17×4=68.
  3. Sum the three layers: 352+528+68=948 learnable parameters.

Common mistakes

How long your answer should be

One sentence showing the sum across layers.

Read this

Previous in Deep learning: Why does an ordinary autoencoder need a bottleneck smaller than the input dimension, or an explicit regulariser?
Next in Deep learning: What goes wrong if you initialise every weight in a multi-layer perceptron to zero (or to the same non-zero constant c)?