def map_(input_layer, fn):
  """Maps the given function across this sequence.

  To map an entire template across the sequence, use the `as_fn` method on the
  template.

  Args:
    input_layer: The input tensor.
    fn: A function of 1 argument that is applied to each item in the sequence.
  Returns:
    A new sequence Pretty Tensor.
  Raises:
    ValueError: If the input_layer does not hold a sequence.
  """
  if not input_layer.is_sequence():
    raise ValueError('Can only map a sequence.')
  return [fn(x) for x in input_layer]
Maps the given function across this sequence.

  To map an entire template across the sequence, use the `as_fn` method on the
  template.

  Args:
    input_layer: The input tensor.
    fn: A function of 1 argument that is applied to each item in the sequence.
  Returns:
    A new sequence Pretty Tensor.
  Raises:
    ValueError: If the input_layer does not hold a sequence.