Skip to content

Instantly share code, notes, and snippets.

@doleron
Last active April 17, 2023 17:18
Show Gist options
  • Save doleron/267415e9000a9471fd89779afbf68e16 to your computer and use it in GitHub Desktop.
Save doleron/267415e9000a9471fd89779afbf68e16 to your computer and use it in GitHub Desktop.
VALIDATION_BATCH_SIZE = 2
def build_validation_dataset():
pairs_tensor = tf.convert_to_tensor(validation_pairs)
labels_tensor = tf.convert_to_tensor(validation_pairs_labels)
result = tf.data.Dataset.from_tensor_slices((pairs_tensor, labels_tensor))
result = result.map(lambda pair, label: (load_images(pair), label))
result = result.batch(VALIDATION_BATCH_SIZE)
result = result.prefetch(tf.data.AUTOTUNE)
return result
validation_ds = build_validation_dataset()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment