FunctionRacerProblemsRace

Many Outputs

MediumPyTorchPython

nn.Linear keeps its weights as a table with one row per output. Given such a table w, a bias b with one number per output, and inputs x with one row per example, return the outputs of the layer: for each example and each output, the dot product of the example with that output's row of w, plus that output's bias.

Example 1

x [[1.0,2.0]]
w [[1.0,0.0],[0.0,1.0],[1.0,1.0]]
b [0.0,0.0,10.0]
returns [[1.0,2.0,13.0]]

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