Search the guide

Start with a guide

Lesson 5 of 14 · Construct programs · Python tutorial

Generate another network’s weights

Train a small generator and inspect the weights it produces.

One network supplies another’s parameters#

A hypernetwork produces parameters for a receiving network. The generator’s input describes which receiving function is needed. In this exercise, numerical descriptors are paired with target weight vectors. Least squares fits the mapping between them.

Fit and use a weight generator#

Python · NumPy
Ready to run

Output

Run the code to see its output.

Try this: Change the descriptor supplied to the fitted generator. Inspect the generated weights and the receiving network’s output.

Runs in your browser. Ctrl/⌘ + Enter runs the code.

The descriptor chooses the function#

After fitting, the generator produces new weights without repeating the fit. The receiving network then computes with those weights. In task-conditioned hypernetworks, the descriptor can encode a task, examples or a task description.

Sources and resources

Course contents