class_docstr: Abstraction for a graph that is used for computing and aggregating metrics.
  
  This abstract class contains methods and lays out the API to handle metrics
  computation and aggregation as part of the TFMA flow. Inheritors of this class
  are responsible for setting up the metrics graph and setting the class
  variables which are required to do metric calculations.
class_docstr_tok: ["Abstraction","for","a","graph","that","is","used","for","computing","and","aggregating","metrics",".","This","abstract","class","contains","methods","and","lays","out","the","API","to","handle","metrics","computation","and","aggregation","as","part","of","the","TFMA","flow",".","Inheritors","of","this","class","are","responsible","for","setting","up","the","metrics","graph","and","setting","the","class","variables","which","are","required","to","do","metric","calculations","."]
docstr: Register additional metric ops that were added.
  
  Args:
    metric_ops: Dictionary of metric ops, just like in the Trainer.
  
  Raises:
    ValueError: One or more of the metric ops already exist in the graph.
docstr_tok: ["Register","additional","metric","ops","that","were","added",".","Args",":","metric_ops",":","Dictionary","of","metric","ops",",","just","like","in","the","Trainer",".","Raises",":","ValueError",":","One","or","more","of","the","metric","ops","already","exist","in","the","graph","."]
code: def register_additional_metric_ops(
      self, metric_ops: Dict[str, Tuple[tf.Tensor, tf.Tensor]]
  ) -> None:
      """Register additional metric ops that were added.
  
      Args:
        metric_ops: Dictionary of metric ops, just like in the Trainer.
  
      Raises:
        ValueError: One or more of the metric ops already exist in the graph.
      """
      for metric_name, (value_op, update_op) in metric_ops.items():
          if metric_name in self._metric_names:
              raise ValueError(
                  "tried to register new metric with name %s, but a "
                  "metric with that name already exists." % metric_name
              )
          self._metric_names.append(metric_name)
          self._metric_value_ops.append(value_op)
          self._metric_update_ops.append(update_op)
  
      # Update metric variables incrementally with only the new elements in the
      # metric_variables collection.
      collection = self._graph.get_collection(
          tf.compat.v1.GraphKeys.METRIC_VARIABLES
      )
      collection = collection[len(self._metric_variable_nodes) :]
  
      # Note that this is a node_list - it's not something that TFMA
      # configures, but something that TF.Learn configures.
      #
      # As such, we also use graph.get_tensor_by_name directly, instead of
      # TFMA's version which expects names encoded by TFMA.
      for node in collection:
          self._metric_variable_nodes.append(node)
          with self._graph.as_default():
              placeholder = tf.compat.v1.placeholder(
                  dtype=node.dtype, shape=node.get_shape()
              )
              self._metric_variable_placeholders.append(placeholder)
              self._metric_variable_assign_ops.append(
                  tf.compat.v1.assign(node, placeholder)
              )
  
      with self._graph.as_default():
          self._all_metric_variable_assign_ops = tf.group(
              *self._metric_variable_assign_ops
          )
          self._all_metric_update_ops = tf.group(
              *self._metric_update_ops
          )
          self._reset_variables_op = (
              tf.compat.v1.local_variables_initializer()
          )
          self._session.run(self._reset_variables_op)
  
      self._perform_metrics_update_fn = self._session.make_callable(
          fetches=self._all_metric_update_ops,
          feed_list=self._perform_metrics_update_fn_feed_list,
      )
  
imports: import abc
  import itertools
  import threading
  from typing import Any, Dict, List, NamedTuple, Tuple
  import apache_beam
  import tensorflow
  from tensorflow_model_analysis import constants
  from tensorflow_model_analysis.api import types
  from tensorflow_model_analysis.eval_saved_model import constants
  from tensorflow_model_analysis.eval_saved_model import util
  from tensorflow_model_analysis.utils import util
label_desc: Use image node_id 6 for calling the EvalMetricsGraph obj's underlying member method code with example usage: obj.register_additional_metric_ops(metric_ops) without return types