<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/models/blob/v2.20.0/official/modeling/tf_utils.py#L200-L212) |

Computes a safe mean of the losses.

    tfm.utils.safe_mean(
        losses
    )

<br />

<br />

<br />

| ## Args ||
|---|---|
| `losses` | `Tensor` whose elements contain individual loss measurements. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| A scalar representing the mean of `losses`. If `num_present` is zero, then zero is returned. ||

<br />