FunctionRacerProblemsRace

A Layer by Hand

EasyPyTorchPython

A linear layer with one output gives, for each row of x, the sum of that row's elements each multiplied by its weight in w, plus the bias b. Return its output for every row: a 1-D tensor.

Example 1

x [[1.0,2.0],[3.0,4.0]]
w [0.5,-1.0]
b 2.0
returns [0.5,-0.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