import tensorflow as tf

        if is_training:
            steps = int(n_examples // batch_size * self._config.num_train_epochs)
        else:
            steps = n_examples // batch_size
        return input_fn, steps

    def serialize_examples(self, examples, is_training, output_file, batch_size):
        """Convert a set of `InputExample`s to a TFRecord file."""
        n_examples = 0
        with tf.python_io.TFRecordWriter(output_file) as writer:
            for (ex_index, example) in enumerate(examples):
                if ex_index % 2000 == 0:
                    utils.log("Writing example {:} of {:}".format(ex_index, len(examples)))
                for tf_example in self._example_to_tf_example(
                    example, is_training, log=self._config.log_examples and ex_index < 1
                ):
                    writer.write(tf_example.SerializeToString())
                    n_examples += 1
