code: def _concat_examples(arrays, padding=0):
      if len(arrays) == 0:
          raise ValueError("batch is empty")
  
      first_elem = arrays[0]
      assert isinstance(first_elem, np.ndarray)
  
      shape = np.array(arrays[0].shape, dtype=int)
      for array in arrays[1:]:
          if np.any(shape != array.shape):
              np.maximum(shape, array.shape, shape)
      shape = tuple(np.insert(shape, 0, len(arrays)))
  
      result = np.full(shape, padding, dtype=arrays[0].dtype)
      for i in six.moves.range(len(arrays)):
          src = arrays[i]
          slices = tuple(slice(dim) for dim in src.shape)
          result[(i,) + slices] = src
      return result
  
file_path: texar/examples/transformer/utils/data_utils.py
imports: import os
  import codecs
  import six
  import numpy
label_desc: Use image node_id 4 for calling a global function with example usage: _concat_examples(arrays, padding) and returns: result