def flat_dict_to_nest(flat_dict, structure):
  """Convert a nested structure into a flat dictionary.

  Args:
    flat_dict: A dictionary with string keys.
    structure: A nested structure.

  Returns:
    nest: A nested structure that inverts `nest_to_flat_dict`.
  """
  flat_sequence = [flat_dict[str(i)] for i in range(len(flat_dict))]
  return tf.nest.pack_sequence_as(
      structure=structure, flat_sequence=flat_sequence)
Convert a nested structure into a flat dictionary.

  Args:
    flat_dict: A dictionary with string keys.
    structure: A nested structure.

  Returns:
    nest: A nested structure that inverts `nest_to_flat_dict`.
  
language/common/utils/nest_utils.py