0
0
TensorFlowml~10 mins

Convolution operation concept in TensorFlow - Interactive Code Practice

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

Complete the code to create a 2D convolutional layer with 32 filters and a kernel size of 3.

TensorFlow
conv_layer = tf.keras.layers.Conv2D(filters=[1], kernel_size=3, activation='relu')
Drag options to blanks, or click blank then click option'
A32
B64
C16
D128
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing a filter number too small to capture enough features.
Confusing kernel_size with filters.
2fill in blank
medium

Complete the code to apply a convolution operation on input tensor x using the conv_layer.

TensorFlow
output = conv_layer([1])
Drag options to blanks, or click blank then click option'
Afeatures
Binput_data
Cimage
Dx
Attempts:
3 left
💡 Hint
Common Mistakes
Passing a variable that is not defined or unrelated to the input.
Using the layer without calling it as a function.
3fill in blank
hard

Fix the error in the code to correctly define a Conv2D layer with a 5x5 kernel size.

TensorFlow
conv = tf.keras.layers.Conv2D(filters=64, kernel_size=[1], activation='relu')
Drag options to blanks, or click blank then click option'
A5
B(5, 5)
C[5, 5]
D5x5
Attempts:
3 left
💡 Hint
Common Mistakes
Using a string like '5x5' which causes a syntax error.
Using a list instead of a tuple.
4fill in blank
hard

Fill both blanks to create a convolutional layer with 16 filters and a stride of 2.

TensorFlow
conv_layer = tf.keras.layers.Conv2D(filters=[1], kernel_size=3, strides=[2], activation='relu')
Drag options to blanks, or click blank then click option'
A16
B1
C2
D32
Attempts:
3 left
💡 Hint
Common Mistakes
Using stride 1 which does not downsample.
Confusing filters with strides.
5fill in blank
hard

Fill all three blanks to create a Conv2D layer with 64 filters, kernel size 3, and 'same' padding.

TensorFlow
conv = tf.keras.layers.Conv2D(filters=[1], kernel_size=[2], padding=[3], activation='relu')
Drag options to blanks, or click blank then click option'
A32
B3
C'same'
D64
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'valid' padding which reduces output size.
Using wrong kernel size format.