def AppendValue(val=None):  # pylint: disable=invalid-name
  """Appends values provided in 'val` to inputs.

  val are keyed by example keys, its values contain appended tensors.

  Args:
    val: dict of int to tensors. Specific keys get the tensors specified in
      values appended.
  Returns:
    Funtion to append tensors to examples.
  """
  @debug_data_pipeline.debug_pipeline
  def _append_value(generator):
    for example in generator:
      if isinstance(example, tuple):
        example = list(example)
        if val is not None:
          for key, value in val.items():
            example[key] = np.append(example[key], value, -1)
        output = tuple(example)
      else:
        if not isinstance(example, np.ndarray):
          raise ValueError(f'example isn\'t nparray, but should be: {example}')
        output = np.append(example, val[0])
      yield output

  return _append_value
Appends values provided in 'val` to inputs.

  val are keyed by example keys, its values contain appended tensors.

  Args:
    val: dict of int to tensors. Specific keys get the tensors specified in
      values appended.
  Returns:
    Funtion to append tensors to examples.
  
trax/data/inputs.py