Code QuizIntermediate

Gradient of a Squared Error

Find the chain-rule mistake in this manual gradient computation.

Codepython
# forward: z = w * x ; loss = (z - y)**2
def grad_w(w, x, y):
    z = w * x
    return 2 * (z - y)

What is the bug in this gradient computation?