---
title: "ClikaRT::ops::mse_loss"
sidebar_label: "mse_loss"
description: "Mean-squared-error loss between input and target. \\[ \\ell_i = (x_i - y_i)^2 \\] Reduction::None returns the per-element losses (shape of input); Mean / Sum reduce to a 0-D scalar."
---

<!-- Generated by tools/doxygen2mdx from Doxygen XML. Do not edit. -->

<span class="api-kind api-kind--function">function</span>

## mse\_loss() {#mse_loss}

<div class="api-signature">

[`Tensor`](../Tensor.md) **`mse_loss`**(<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`Tensor`](../Tensor.md) `input`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`Tensor`](../Tensor.md) `target`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`Reduction`](./index.md#Reduction) `reduction` `=` [`Reduction::Mean`](./index.md#Reduction)<br />
)

</div>

Mean-squared-error loss between `input` and `target`.

$$
\ell_i = (x_i - y_i)^2
$$

[`Reduction::None`](./index.md#Reduction) returns the per-element losses (shape of `input`); `Mean` / `Sum` reduce to a 0-D scalar.

**Parameters**

- `input`: predictions; float dtype.
- `target`: ground truth; same shape as `input`.
- `reduction`: `None` / `Mean` / `Sum`; default `Mean`.

**Returns:** the loss (0-D under `Mean`/`Sum`).

**Throws**

- `ClikaRT::Error`: (`INVALID_ARGUMENT`) on an input/target shape mismatch.

<div class="api-declared">

Declared in `ClikaRT/compute/ops.h`, line 3086

</div>
