0
0
TensorFlowml~5 mins

Prefetching for performance in TensorFlow - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is prefetching in TensorFlow data pipelines?
Prefetching is a technique that prepares the next batch of data while the current batch is being processed, helping to keep the GPU or CPU busy without waiting for data loading.
Click to reveal answer
beginner
How does prefetching improve model training performance?
Prefetching reduces idle time by overlapping data preparation and model training, so the model always has data ready to process, which speeds up training.
Click to reveal answer
beginner
Which TensorFlow method is used to add prefetching to a dataset?
The method is dataset.prefetch(buffer_size), where buffer_size controls how many batches to prepare in advance.
Click to reveal answer
intermediate
What does setting buffer_size=tf.data.AUTOTUNE do in prefetching?
It lets TensorFlow automatically decide the best number of batches to prefetch based on available CPU and GPU resources.
Click to reveal answer
intermediate
Why might prefetching not always improve performance?
If data loading is very fast or the model is slow, prefetching may not help much. Also, too large a buffer size can use too much memory.
Click to reveal answer
What is the main goal of prefetching in TensorFlow?
ATo improve model accuracy by changing weights
BTo increase the size of the training dataset
CTo reduce the number of training epochs
DTo prepare data batches ahead of time to reduce waiting
Which method adds prefetching to a TensorFlow dataset?
Adataset.prefetch()
Bdataset.repeat()
Cdataset.shuffle()
Ddataset.batch()
What does buffer_size=tf.data.AUTOTUNE do in prefetching?
ADisables prefetching
BAutomatically tunes buffer size for best performance
CSets buffer size to zero
DPrefetches only one batch
When might prefetching NOT improve training speed?
AWhen data loading is slow
BWhen model training is very fast
CWhen data loading is very fast or model is slow
DWhen using GPUs
What is a risk of setting a very large prefetch buffer size?
AUsing too much memory
BSlower training
CLower model accuracy
DData corruption
Explain how prefetching works in TensorFlow and why it helps training performance.
Think about what happens while the model is busy training on one batch.
You got /4 concepts.
    Describe how to add prefetching to a TensorFlow dataset and what the buffer size controls.
    Consider the method name and what the buffer size means.
    You got /3 concepts.