0
0
TensorFlowml~10 mins

Why efficient data loading prevents bottlenecks in TensorFlow - Test Your Understanding

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to create a TensorFlow dataset from a list of file paths.

TensorFlow
dataset = tf.data.Dataset.from_tensor_slices([1])
Drag options to blanks, or click blank then click option'
Anum_epochs
Bfile_paths
Cshuffle_buffer
Dbatch_size
Attempts:
3 left
💡 Hint
Common Mistakes
Using batch size or shuffle buffer instead of the data source.
Confusing dataset creation parameters.
2fill in blank
medium

Complete the code to apply a map function to preprocess images in the dataset.

TensorFlow
dataset = dataset.map([1])
Drag options to blanks, or click blank then click option'
Ashuffle
Bbatch
Cload_and_preprocess_image
Drepeat
Attempts:
3 left
💡 Hint
Common Mistakes
Using batch or shuffle methods inside map.
Passing a method name that is not a function.
3fill in blank
hard

Fix the error in the code to enable parallel data loading.

TensorFlow
dataset = dataset.map(load_and_preprocess_image, [1]=tf.data.AUTOTUNE)
Drag options to blanks, or click blank then click option'
Arepeat_count
Bbatch_size
Cshuffle_buffer_size
Dnum_parallel_calls
Attempts:
3 left
💡 Hint
Common Mistakes
Using batch_size or shuffle_buffer_size as map arguments.
Not enabling parallel calls causes slow data loading.
4fill in blank
hard

Fill both blanks to batch the dataset and prefetch data for efficiency.

TensorFlow
dataset = dataset.[1](32).[2](tf.data.AUTOTUNE)
Drag options to blanks, or click blank then click option'
Abatch
Bshuffle
Cprefetch
Drepeat
Attempts:
3 left
💡 Hint
Common Mistakes
Using shuffle instead of batch.
Not using prefetch causes slower training.
5fill in blank
hard

Fill all three blanks to shuffle, batch, and prefetch the dataset correctly.

TensorFlow
dataset = dataset.[1](1000).[2](64).[3](tf.data.AUTOTUNE)
Drag options to blanks, or click blank then click option'
Ashuffle
Bbatch
Cprefetch
Drepeat
Attempts:
3 left
💡 Hint
Common Mistakes
Incorrect order of operations.
Skipping prefetch causes bottlenecks.