def example_batch_to_list(example_batch, num_templates):
  """Convert a single batch item in a dataset to a list of items.

  Say you have a dataset where each item is shape {question: (), answer: ()}.
  An example_batch will be a batched example with shape {question: (None,),
  answer: (None,)}.
  This will convert this example_batch to a list of examples, each with shape
  {question: (), answer: ()}.

  Args:
    example_batch: a single batch item in a dataset
    num_templates: the number of templates that are written, equal to batch size

  Returns:
    A list of items.
  """
  return [
      {k: v[i] for k, v in example_batch.items()} for i in range(num_templates)
  ]