Premium problem72. Count Trainable Parameters

Easy Locked

Build Sequential(Linear(in_features, hidden), ReLU(), Linear(hidden, out_features)) after seeding with torch.manual_seed(seed), and return the total number of individual scalar parameters that have requires_grad set -- weights and biases alike, counted element by element rather than tensor by tensor.

Return a plain Python int.

Input

in_features = 4
hidden = 8
out_features = 3
seed = 0

Output

67

Premium problem

This one's part of Premium. Unlock the full PyTorch track plus every other premium problem on the site.

Implement solve(...)