Complete the code to add a MaxPooling2D layer with pool size 2x2.
model.add(tf.keras.layers.MaxPooling2D(pool_size=[1]))The pool_size parameter defines the size of the window to take the maximum over. (2, 2) is a common choice for downsampling.
Complete the code to add an AveragePooling2D layer with pool size 3x3.
model.add(tf.keras.layers.AveragePooling2D(pool_size=[1]))AveragePooling2D with pool_size (3, 3) computes the average over 3x3 windows, reducing spatial dimensions accordingly.
Fix the error in the code to correctly add a MaxPooling2D layer with stride 2.
model.add(tf.keras.layers.MaxPooling2D(pool_size=(2, 2), strides=[1]))
The strides parameter controls how far the pooling window moves each step. For downsampling by half, strides should be (2, 2).
Fill both blanks to create a dictionary comprehension that maps each word to its length if length is greater than 3.
{word: [1] for word in words if [2]The dictionary comprehension maps each word to its length (len(word)) only if the length is greater than 3 (len(word) > 3).
Fill all three blanks to create a dictionary comprehension mapping uppercase words to their lengths if length is greater than 4.
{ [1]: [2] for word in words if [3] }The dictionary comprehension maps the uppercase version of each word (word.upper()) to its length (len(word)) only if the length is greater than 4 (len(word) > 4).