def maybe_broadcast_structure(from_structure: Any, to_structure: Any) -> Any:
flat_from = tf.nest.flatten(from_structure)<EOL>flat_to = tf.nest.flatten(to_structure)<EOL>if len(flat_from) == <NUM_LIT:1>:<EOL><INDENT>flat_from *= len(flat_to)<EOL><DEDENT>return tf.nest.pack_sequence_as(to_structure, flat_from)<EOL>
Maybe broadcasts `from_structure` to `to_structure`.

    If `from_structure` is a singleton, it is tiled to match the structure of
    `to_structure`. Note that the elements in `from_structure` are not copied if
    this tiling occurs.

    Args:
      from_structure: A structure.
      to_structure: A structure.

    Returns:
      new_from_structure: Same structure as `to_structure`.