Skip to content

Instantly share code, notes, and snippets.

@hadifar
Created December 6, 2018 08:30
Show Gist options
  • Save hadifar/56d9bf89b9a8b336d318f16e3b5a5ee3 to your computer and use it in GitHub Desktop.
Save hadifar/56d9bf89b9a8b336d318f16e3b5a5ee3 to your computer and use it in GitHub Desktop.
training_dataset = tf.data.Dataset.from_tensor_slices((train_data, train_labels)).repeat(5).shuffle(1024).batch(batch_size)
test_dataset = tf.data.Dataset.from_tensor_slices((test_data, test_labels)).repeat(1).batch(batch_size)
iterator = tf.data.Iterator.from_structure(training_dataset.output_types,
training_dataset.output_shapes)
train_init_op = iterator.make_initializer(training_dataset)
test_init_op = iterator.make_initializer(test_dataset)
# Input data
x, y = iterator.get_next()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment