code: def varlength_concat_py(x, y, x_length, dtype=None):
      """Concatenates rows of `x` and `y` where each row of
      `x` has a variable length.
  
      The function has the same semantic as :func:`varlength_concat`,
      except that this function is for numpy arrays instead of TF tensors.
  
      Both `x` and `y` are of numeric dtypes, such as `int32` and `float32`,
      with mask value `0`. The two arrays must be of the same dtype.
  
      Args:
          x: A array of shape `[batch_size, x_dim_2, other_dims]`.
          y: A array of shape `[batch_size, y_dim_2, other_dims]`.
              All dimensions except the 2nd dimension must be the same
              with those of `x`.
          x_length: A 1D int array of shape `[batch_size]` containing
              the length of each `x` row.
              Elements beyond the respective lengths will be
              made zero.
          dtype: Type of :attr:`x`. If `None`, inferred from
              :attr:`x` automatically.
  
      Returns:
          An array of shape `[batch_size, x_dim_2 + y_dim_2, other_dims]`.
  
      Example:
          .. code-block:: python
  
              x = np.asarray([[1, 1, 0, 0],
                              [1, 1, 1, 0]])
              x_length = [2, 3]
              y = np.asarray([[2, 2, 0],
                              [2, 2, 2]])
  
              out = varlength_concat_py(x, y, x_length)
              # out = [[1, 1, 2, 2, 0, 0, 0]
              #        [1, 1, 1, 2, 2, 2, 0]]
      """
      x = np.asarray(x, dtype=dtype)
      y = np.asarray(y, dtype=dtype)
  
      x_masked = mask_sequences(x, x_length, dtype=dtype)
      zeros_y = np.zeros_like(y)
      x_aug = np.concatenate([x_masked, zeros_y], axis=1)
  
      zeros_x = np.zeros_like(x)
      y_aug = np.concatenate([zeros_x, y], axis=1)
  
      # Now, x_aug.shape == y_aug.shape
  
      max_length_x = x.shape[1]
      batch_size = x.shape[0]
  
      for index in np.arange(batch_size):
          y_aug_i_rolled = np.roll(
              a=y_aug[index],
              shift=x_length[index] - max_length_x,
              axis=0,
          )
          x_aug[index] += y_aug_i_rolled
  
      return x_aug
  
file_path: texar/texar/tf/utils/shapes.py
imports: import numpy
  import tensorflow
  from tensorflow.python.util import nest
  from tensorflow.python.ops import rnn
  from tensorflow.python.framework import ops
label_desc: Use image node_id 12 for calling a global function with example usage: varlength_concat_py(x, y, x_length, dtype) and returns: x_aug