tfm.utils.safe_mean

Computes a safe mean of the losses.

losses Tensor whose elements contain individual loss measurements.

A scalar representing the mean of losses. If num_present is zero, then zero is returned.