code: def merge_tensor_values(
      tensor_values: List[types.TensorValue],
  ) -> Optional[types.TensorValue]:
      """Merge a list of Tensor values into a single batch of Tensor values.
  
      Args:
        tensor_values: A list of Tensor values, all fetched from the same node in
          the same graph. Each Tensor value should be for a single example.
  
      Returns:
        A single Tensor value that represents a batch of all the Tensor values
        in the given list.
  
      Raises:
        ValueError: Got a SparseTensor with more than 1 row (i.e. that is likely
          to be for more than one example).
        TypeError: tensor_value had unknown type.
      """
      if not tensor_values:
          return None
  
      if isinstance(tensor_values[0], tf.compat.v1.SparseTensorValue):
          # Check batch sizes.
          for tensor_value in tensor_values:
              if tensor_value.dense_shape[0] > 1:
                  raise ValueError(
                      "expecting SparseTensor to be for only 1 example. "
                      "but got dense_shape %s instead"
                      % tensor_value.dense_shape
                  )
          return _sparse_concat_rows(tensor_values)
      elif isinstance(tensor_values[0], np.ndarray):
          return _dense_concat_rows(tensor_values)
      else:
          raise TypeError(
              "tensor_values[0] had unknown type: %s, value was: %s"
              % (type(tensor_values[0]), tensor_values[0])
          )
  
file_path: model-analysis/tensorflow_model_analysis/eval_saved_model/util.py
imports: from typing import Any, Callable, List, Optional, Tuple
  import numpy
  import tensorflow
  from tensorflow import estimator
  from tensorflow_model_analysis.api import types
  from tensorflow_model_analysis.utils import util
  from tensorflow.core.example import example_pb2
label_desc: Use image node_id 10 for calling a global function with example usage: merge_tensor_values(tensor_values) and returns: None, _sparse_concat_rows, _dense_concat_rows