code: def _dense_concat_rows(arrays: List[np.ndarray]) -> np.ndarray:
      """Concat a list of np.arrays along rows.
  
      This is similar to (but not the same as) np.concatenate(arrays, axis=0),
      However, this assumes that each array represents a single row (so
      shape[0] == 1), but the other dimensions are allowed to
      vary across the list. The final shape will be
        len(arrays) x max(shape[:, 1]) x max(shape[:, 2]) x ...
  
      The dense tensors will be padded with the appropriate default value
      (e.g. 0 for ints, 0.0 for floats, '' for strings). We assume that this is
      the desired behaviour - some models may require different padding
      (b/111007595).
  
      We need this to support cases where predictions are of variable length.
  
      For example, if the values are:
        (1x2x1) [[[10], [11]]]
        (1x1x3) [[[20, 21, 22]]]
        (1x3x2) [[[30, 31], [32, 33], [34, 35]]]
        (1x1x2) [[[40, 41]]]
  
      Then the result will be:
        (4x3x3)
  
        [[[10,  0,  0],
          [11,  0,  0],
          [ 0,  0,  0]],
  
         [[20, 21, 22],
          [ 0,  0,  0],
          [ 0,  0,  0]],
  
         [[30, 31,  0],
          [32, 33,  0],
          [34, 35,  0],
  
         [[40, 41,  0],
          [ 0,  0,  0],
          [ 0,  0,  0]]])
  
      Args:
        arrays: List of np.arrays to concatenate together.
  
      Returns:
        A single np.array, representing the concatenated np.arrays
  
      Raises:
        ValueError: arrays was an empty list; or an np.array in the list was not
          for exactly one row.
      """
      if not arrays:
          raise ValueError("arrays must be a non-empty list.")
  
      shape_max = np.amax(np.array([a.shape for a in arrays]), axis=0)
      if arrays[0].dtype == object:
          # Assume if the dtype is object then the array contains strings.
          padding_value = ""
      else:
          padding_value = arrays[0].dtype.type()
  
      padded_arrays = []
      for array in arrays:
          if array.shape[0] != 1:
              raise ValueError(
                  "each array should only have one row, but %s had shape %s"
                  % (array, array.shape)
              )
          # We use concatenation instead of padding because np.concatenate is much
          # faster than np.pad: see
          # https://stackoverflow.com/questions/12668027/
          # good-ways-to-expand-a-numpy-ndarray
          for i, actual in enumerate(array.shape[1:]):
              axis = i + 1
              num_to_pad = shape_max[axis] - actual
              if num_to_pad > 0:
                  fill_shape = np.copy(array.shape)
                  fill_shape[axis] = num_to_pad
                  array = np.concatenate(
                      [array, np.full(fill_shape, padding_value)],
                      axis=axis,
                  )
  
          padded_arrays.append(array)
  
      return np.concatenate(padded_arrays, axis=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 6 for calling a global function with example usage: _dense_concat_rows(arrays) and returns: np