import tensorflow as tf
import tensorflow_datasets as tfds
# Construct a tf.data.Dataset
ds = tfds.load('titanic', split='train', shuffle_files=True)
ds = ds.shuffle(1024).batch(32).prefetch(tf.data.experimental.AUTOTUNE)
for example in ds.take(1):
# Print features for the batch input
print(" Input Features")
print(example['features'])
# Print labels for batch input
print(" Input Labels")
print(example['survived'])