code: def pack_sequence_as(example, name="restructure"):
      """Returns a Bijector variant of tf.nest.pack_sequence_as.
  
      See also the `Restructure` bijector for general rearrangements.
  
      Args:
        example: A Tensor or (potentially nested) collection of Tensors.
        name: An optional Python string, inserted into names of TF ops
          created by this bijector.
  
      Returns:
        pack: A Bijector whose `forward` method packs a list of Tensors of
          the right length into a structure parallel to `example`, and
          whose `inverse` method flattens structures parallel to `example`
          into a list of Tensors.
  
      #### Example
  
      ```python
      x = tf.constant(1)
      example = collections.OrderedDict([
          ('a', [x, x, x]),
          ('b', x)])
      bij = tfb.pack_sequence_as(example)
      bij.forward([1, 2, 3, 4.])
  
      # Returns
      # collections.OrderedDict([
      #     ('a', [1, 2, 3]),
      #     ('b', 4.)])
      ```
  
      """
      tokens = tf.nest.pack_sequence_as(
          example, list(range(len(tf.nest.flatten(example))))
      )
      return Restructure(output_structure=tokens, name=name)
  
imports: import six
  import tensorflow.compat.v2
  from tensorflow_probability.python.bijectors import bijector
  from tensorflow_probability.python.bijectors import invert
  from tensorflow_probability.python.internal import dtype_util
  from tensorflow_probability.python.internal import nest_util
  from tensorflow_probability.python.internal import parameter_properties
  from tensorflow.python.util import nest
label_desc: Use image node_id 3 for calling a global function with example usage: pack_sequence_as(example, name) and returns: Restructure