MSE Loss Forward and Backward

easy
Checkpoint challenge
Solve this to show you know the material and jump straight to Unit 5. Everything before it counts as cleared.

Implement mean squared error over all elements and its gradient with respect to the predictions:

  • mse(pred, target) = 1N∑(p−t)2\frac{1}{N}\sum (p - t)^2 where NN is the total number of elements
  • mse_grad(pred, target) = 2N(p−t)\frac{2}{N}(p - t), same shape as pred
#losses#backprop2 visible + 1 hidden tests
solution.py · Python 3.13
Loading editor…
Run your code to see results. ⌘↵ to run · ⌘⇧↵ to submit
MSE Loss Forward and Backward · TechGradify