FunctionRacerProblemsRace

Two Layers

MediumPyTorchPython

A network with two layers. The first turns each example x into h = relu(w1 · x + b1), and the second turns that into w2 · h + b2. Both weight tables have one row per output, as nn.Linear keeps them. Return the outputs for the examples in x, one row each.

Example 1

x [[1.0,-1.0]]
w1 [[1.0,0.0],[0.0,1.0]]
b1 [0.0,0.0]
w2 [[1.0,1.0]]
b2 [0.5]
returns [[1.5]]

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