def get_eval_dictionary(estimator, checkpoint, eval_input_fn, eval_name=None):
  """run inference and get eval results."""
  eval_results = dict()
  all_results = []
  n_proc = 0
  results = estimator.predict(
      input_fn=eval_input_fn, checkpoint_path=checkpoint)
  for result in results:
    q_ids = result["q_ids"]
    cand_nums = result["cand_nums"]
    probs = result["probabilities"]
    label_ids = result["label_ids"]
    scores = result["scores"]
    cand_index = 0
    n_proc = n_proc + 1
    while cand_index < len(q_ids):
      q_id = q_ids[cand_index]
      cand_num = cand_nums[cand_index]
      prob = probs[cand_index]
      label_id = label_ids[cand_index]
      score = scores[cand_index]
      cand_index = cand_index + 1
      all_results.append(
          RawResult(
              q_id=q_id,
              cand_num=cand_num,
              prob=prob,
              label_id=label_id,
              prior_score=score))
  eval_results = rank_metrics(
      all_results,
      FLAGS.output_dir,
      FLAGS.global_step,
      eval_name,
      save_raw=True)
  tf.logging.info("Eval results: %s", eval_results)

  return eval_results
run inference and get eval results.
language/multivec/models/ranking_model_experiment_inbatch.py