import tensorflow as tf

def characters(filename, batch_size, sequence_size):
    """Returns a dataset of characters from the given file."""

    def _to_chars(line):
        """string scalar -> Dataset of characters (string scalars)."""
        chars, = tf.py_func(_split_string, [line + "\n"], [tf.string])
        chars.set_shape([None])
        return tf.data.Dataset.from_tensor_slices(chars)

    return (tf.data.TextLineDataset([filename])
