Function mse_loss
Source pub fn mse_loss<B>(
prediction: &Tensor<B>,
target: &Tensor<B>,
) -> Result<Tensor<B>, Error>
Expand description
Mean Squared Error loss: mean((prediction - target)²)
Both prediction and target must have the same shape.
Returns a scalar tensor.
§Example
ⓘlet loss = mse_loss(&y_pred, &y_true)?;
let grads = loss.backward()?;