01-hypothesis-function's input @ weight.T combined many elements together into each output value, that's what matrix multiplication does. Most of the arithmetic inside a neural network isn't like that at all: adding a bias, subtracting a target from a prediction, scaling a gradient, these all act on corresponding positions independently, one input element in, one output element out, no mixing across positions. That's "elementwise," and it's the most common shape of computation in this whole curriculum, worth its own question before anything more complex is layered on top.
Implement add, sub, mul, div, power, each mirroring the torch.* function (and the operator, +/-/*///**) of the same name. Four of the five are direct one-line translations; div is the one place Theory's warning about integer-vs-float division actually has to be handled deliberately rather than left to whichever operator happens to get used.
a and b the normal NumPy way (including a scalar against an array).div(a, b) always returns a floating-point result, even when both a and b are integer arrays — never Python's // floor-division behavior.Open one at a time. Each gives away a little more than the last.
Four of these five functions are exactly the Python operator you'd expect (+, -, *, **) applied directly to a and b. Only one of them needs something other than its bare operator.
A plain a / b between two integer NumPy arrays already returns a float in NumPy (NumPy's / is true division by default, unlike Python's //). The point of div isn't to fix a bug NumPy has, it's to name the function NumPy's own / operator actually calls internally, so the choice reads as deliberate: np.true_divide.
Click "Run Tests" to test your implementation