tfm.utils.safe_mean

Stay organized with collections Save and categorize content based on your preferences.

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.