Premium problem52. Mean Absolute Error

Easy Locked

Return the mean absolute error between pred and target: the average of |pred_i - target_i| over all elements.

Input

pred = tensor([1., 2., 3.])
target = tensor([1.5000, 2.5000, 2.0000])

Output

tensor(0.6667)

Premium problem

This one's part of Premium. Unlock the full PyTorch track plus every other premium problem on the site.

Implement solve(...)