code: def brier_score(labels, logits, name=None):
      r"""Compute Brier score for a probabilistic prediction.
  
      The [Brier score][1] is a loss function for probabilistic predictions over a
      number of discrete outcomes.  For a probability vector `p` and a realized
      outcome `k` the Brier score is `sum_i p[i]*p[i] - 2*p[k]`.  Smaller values are
      better in terms of prediction quality.  The Brier score can be negative.
  
      Compared to the cross entropy (aka logarithmic scoring rule) the Brier score
      does not strongly penalize events which are deemed unlikely but do occur,
      see [2].  The Brier score is a strictly proper scoring rule and therefore
      yields consistent probabilistic predictions.
  
      #### References
      [1]: G.W. Brier.
           Verification of forecasts expressed in terms of probability.
           Monthley Weather Review, 1950.
      [2]: Tilmann Gneiting, Adrian E. Raftery.
           Strictly Proper Scoring Rules, Prediction, and Estimation.
           Journal of the American Statistical Association, Vol. 102, 2007.
           https://www.stat.washington.edu/raftery/Research/PDF/Gneiting2007jasa.pdf
  
      Args:
        labels: Tensor, (N1, ..., Nk), with tf.int32 or tf.int64 elements containing
          ground truth class labels in the range [0, num_classes].
        logits: Tensor, (N1, ..., Nk, num_classes), with logits for each example.
        name: Python `str` name prefixed to Ops created by this function.
  
      Returns:
        brier_score: Tensor, (N1, ..., Nk), containint elementwise Brier scores;
          caller should `reduce_mean()` over examples in a dataset.
      """
      with tf.name_scope(name or "brier_score"):
          labels = tf.convert_to_tensor(labels)
          logits = tf.convert_to_tensor(logits)
          probabilities = tf.math.softmax(logits, axis=1)
  
          num_classes = probabilities.shape[-1]
          plabel = probabilities * tf.one_hot(
              labels, depth=num_classes, dtype=probabilities.dtype
          )
          plabel = tf.reduce_sum(plabel, axis=-1)
          return (
              tf.reduce_sum(tf.square(probabilities), axis=-1)
              - 2.0 * plabel
          )
  
file_path: probability/tensorflow_probability/python/stats/calibration.py
imports: import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.internal import dtype_util
  from tensorflow_probability.python.internal import prefer_static
  from tensorflow_probability.python.internal import tensorshape_util
  from tensorflow_probability.python.math import generic
  from tensorflow_probability.python.stats import quantiles
label_desc: Use image node_id 2 for calling a global function with example usage: brier_score(labels, logits, name) and returns: unknown