code: def total(
      values: types.TensorType,
  ) -> Tuple[types.TensorType, types.TensorType]:
      """Metric to compute the running total of a value."""
  
      with tf.compat.v1.variable_scope("total", values):
          values = tf.cast(values, tf.float64)
          total_value = tf.compat.v1.Variable(
              initial_value=0.0,
              dtype=tf.float64,
              trainable=False,
              collections=[
                  tf.compat.v1.GraphKeys.METRIC_VARIABLES,
                  tf.compat.v1.GraphKeys.LOCAL_VARIABLES,
              ],
              validate_shape=True,
              name="total",
          )
          update_op = tf.compat.v1.assign_add(
              total_value, tf.reduce_sum(input_tensor=values)
          )
          value_op = tf.identity(total_value)
          return value_op, update_op
  
file_path: model-analysis/tensorflow_model_analysis/post_export_metrics/metrics.py
imports: from typing import List, Optional, Tuple
  import numpy
  import tensorflow
  from tensorflow_model_analysis.api import types
label_desc: Use image node_id 1 for calling a global function with example usage: total(values) and returns: value_op,  update_op