← TensorFlow & Keras learning path
TensorFlow & Keras · Module 5 of 10

Data pipelines with tf.data

Feed data efficiently during training.

📖 Key ideas

  1. tf.data.Dataset builds input pipelines.
  2. from_tensor_slices, image_dataset_from_directory create datasets.
  3. map applies preprocessing; batch groups examples; shuffle randomises.
  4. prefetch overlaps data loading with training.
  5. cache stores data after the first epoch.
💡 Real-life example: tf.data is a conveyor belt bringing ingredients to the chef just in time.
tf.data.DatasetInput pipeline object
batch()Groups examples
prefetch()Loads next batch in advance
shuffle()Randomises order