0
0
TensorFlowml~10 mins

Why CNNs understand visual patterns 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 import the TensorFlow library.

TensorFlow
import [1] as tf
Drag options to blanks, or click blank then click option'
Atensorflow
Btorch
Cnumpy
Dsklearn
Attempts:
3 left
💡 Hint
Common Mistakes
Importing PyTorch or NumPy instead of TensorFlow.
2fill in blank
medium

Complete the code to add a convolutional layer with 32 filters and kernel size 3.

TensorFlow
model = tf.keras.Sequential([
    tf.keras.layers.Conv2D([1], kernel_size=3, activation='relu', input_shape=(28, 28, 1))
])
Drag options to blanks, or click blank then click option'
A64
B32
C16
D128
Attempts:
3 left
💡 Hint
Common Mistakes
Using too few or too many filters like 16 or 128.
3fill in blank
hard

Fix the error in the code to compile the CNN model with Adam optimizer.

TensorFlow
model.compile(optimizer='[1]', loss='sparse_categorical_crossentropy', metrics=['accuracy'])
Drag options to blanks, or click blank then click option'
Aadagrad
Bsgd
Crmsprop
Dadam
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'Adam' with uppercase A or other optimizers causing slower training.
4fill in blank
hard

Fill both blanks to create a dictionary comprehension that maps each image to its label if the label is 0.

TensorFlow
filtered_data = {img: label for img, label in dataset.items() if label [1] [2]
Drag options to blanks, or click blank then click option'
A==
B!=
C0
D1
Attempts:
3 left
💡 Hint
Common Mistakes
Using '!=' instead of '==' or wrong label number.
5fill in blank
hard

Fill all three blanks to create a dictionary of image sizes for images with width greater than 28.

TensorFlow
image_sizes = {img: (width, height) for img, (width, height) in images.items() if width [1] [2] and height [3] 28}
Drag options to blanks, or click blank then click option'
A>
B28
C>=
D<
Attempts:
3 left
💡 Hint
Common Mistakes
Using '>=' instead of '>' or wrong comparison operators.