class_docstr: Implements base ranking metric class.
  
  Please see tf.keras.metrics.Mean for more information about such a class and
  https://www.tensorflow.org/tutorials/distribute/custom_training on how to do
  customized training.
class_docstr_tok: ["Implements","base","ranking","metric","class",".","Please","see","tf.keras.metrics.Mean","for","more","information","about","such","a","class","and","https",":","\/\/www.tensorflow.org\/tutorials\/distribute\/custom_training","on","how","to","do","customized","training","."]
docstr: Accumulates metric statistics.
  
  `y_true` and `y_pred` should have the same shape.
  
  Args:
    y_true: The ground truth values.
    y_pred: The predicted values.
    sample_weight: Optional weighting of each example. Defaults to 1. Can be a
      `Tensor` whose rank is either 0, or the same rank as `y_true`, and must
      be broadcastable to `y_true`.
  
  Returns:
    Update op.
docstr_tok: ["Accumulates","metric","statistics",".","`","y_true","`","and","`","y_pred","`","should","have","the","same","shape",".","Args",":","y_true",":","The","ground","truth","values",".","y_pred",":","The","predicted","values",".","sample_weight",":","Optional","weighting","of","each","example",".","Defaults","to","1",".","Can","be","a","`","Tensor","`","whose","rank","is","either","0",",","or","the","same","rank","as","`","y_true","`",",","and","must","be","broadcastable","to","`","y_true","`",".","Returns",":","Update","op","."]
code: def update_state(self, y_true, y_pred, sample_weight=None):
      """Accumulates metric statistics.
  
      `y_true` and `y_pred` should have the same shape.
  
      Args:
        y_true: The ground truth values.
        y_pred: The predicted values.
        sample_weight: Optional weighting of each example. Defaults to 1. Can be a
          `Tensor` whose rank is either 0, or the same rank as `y_true`, and must
          be broadcastable to `y_true`.
  
      Returns:
        Update op.
      """
      y_true = tf.cast(y_true, self._dtype)
      y_pred = tf.cast(y_pred, self._dtype)
  
      # TODO: Add mask argument for metric.compute() call
      (
          per_list_metric_val,
          per_list_metric_weights,
      ) = self._metric.compute(y_true, y_pred, sample_weight)
      return super(_RankingMetric, self).update_state(
          per_list_metric_val, sample_weight=per_list_metric_weights
      )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from typing import Any, Dict, List, Optional
  import tensorflow.compat.v2
  from tensorflow_ranking.python import metrics_impl
  from tensorflow_ranking.python.keras import utils
label_desc: Use image node_id 2 for calling the _RankingMetric obj's underlying member method code with example usage: obj.update_state(y_true, y_pred, sample_weight) and returns: super