Last active
January 29, 2020 22:00
-
-
Save zredlined/a6d39721e7054835d8f24a6ce3f6a3c8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def split_input_target(chunk): | |
input_text = chunk[:-1] | |
target_text = chunk[1:] | |
return input_text, target_text | |
BATCH_SIZE = 64 | |
BUFFER_SIZE = 10000 | |
# Create TensorFlow training examples and targets | |
char_dataset = tf.data.Dataset.from_tensor_slices(text_as_int) | |
sequences = char_dataset.batch(seq_length+1, drop_remainder=True) | |
dataset = sequences.map(split_input_target) | |
dataset = dataset.shuffle(BUFFER_SIZE).batch(BATCH_SIZE, drop_remainder=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment