import tensorflow as tf


  eval_steps = FLAGS.num_eval_images // FLAGS.eval_batch_size
  iterations_per_loop = (eval_steps if FLAGS.mode == 'eval'
                         else FLAGS.iterations_per_loop)
  save_checkpoints_steps = FLAGS.save_checkpoints_steps or iterations_per_loop
  run_config = tf.contrib.tpu.RunConfig(
      cluster=tpu_cluster_resolver,
      model_dir=FLAGS.model_dir,
      save_checkpoints_steps=save_checkpoints_steps,
      keep_checkpoint_max=None,
      tpu_config=tf.contrib.tpu.TPUConfig(
          iterations_per_loop=iterations_per_loop,
          num_shards=FLAGS.num_shards,
          per_host_input_for_training=tf.contrib.tpu.InputPipelineConfig.PER_HOST_V2
      ))
  return run_config


def build_image_serving_input_receiver_fn(shape,
                                          dtype=tf.float32):
