FunctionRacerProblemsRace

Count the Parameters

MediumPyTorchPython

A network is a chain of nn.Linear layers, and sizes lists the sizes along it: [4, 8, 2] is a layer from 4 to 8 followed by a layer from 8 to 2. Return how many numbers the network learns in all: every weight and every bias.

Example 1

sizes [4,8,2]
returns 58

4 times 8 weights and 8 biases, then 8 times 2 weights and 2 biases: 40 + 18.

Constraints

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More PyTorch problems