MSE Loss Forward and Backward

easy
Unit 4 · Optimization & CNNs0/3 to milestone

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