def METHOD_NAME(probabilities, targets, weights=None):
  return metrics.mean(
      losses.sparse_softmax_cross_entropy(probabilities,
                                          math_ops.cast(targets, dtypes.int32)),
      weights=weights)