# Implement Mean Squared Error Loss

0

In this exercise, you are required to manually compute the Mean Squared Error (MSE) loss between two tensors, representing predicted values and actual values, respectively. The MSE is calculated as the average of the squared differences between corresponding elements in the two tensors. The solution should support tensors of any dimensionality, as long as the input_tensor and target_tensor have the same shape.

$MSE = \frac{1}{N} \sum_{i=1}^{N} (y_i - \hat{y}_i)^2$

Where:

- $y_i$: Each individual actual data point.
- $\hat{y}_i$: Each individual predicted data point.
- $MSE$: Mean Squared Error between the actual and predicted data points.
- $N$: Total number of data points.

### Examples:

1.0

2.0

3.0

1.0

2.5

2.5

↓

0.1666666716337204

3.0

-3.0

0.0

1

0

0

3.0

-2.5

0.5

1

-1

1

↓

0.4166666567325592

Loading...