def load_batched_dataset(is_train, embeddings):
  """Loads a dataset that has been batched and preprocessed."""
  tensorize_text_fn = build_tensorize_text_fn(embeddings)
  unbatched = load_data(is_train)

  def tensorize(x):
    x["premise"] = tensorize_text_fn(x["premise"])
    x["hypothesis"] = tensorize_text_fn(x["hypothesis"])
    return x

  unbatched = unbatched.map(tensorize)

  hist_bins = list(range(5, 500, 5))
  batched = unbatched.apply(
      ops.bucket_by_quantiles(lambda x: x["premise"]["len"], FLAGS.batch_size,
                              10, hist_bins))
  if is_train:
    batched = batched.shuffle(1000, reshuffle_each_iteration=True)
    batched = batched.repeat()

  # Get (features, label) format for tf.estimator
  return batched.map(lambda x: (x, x["label"]))
Loads a dataset that has been batched and preprocessed.
language/boolq/run_recurrent_model_boolq.py