In convolutional model encountering the following error
input_img = tf.keras.Input(shape=input_shape)
## CONV2D: 8 filters 4x4, stride of 1, padding ‘SAME’
Z1 = tf.keras.layers.Conv2D(filters = 8, strides=(1), kernel_size = [4, 4], padding = ‘same’)(input_img)
## RELU
A1 = tf.keras.layers.ReLU()(Z1)
## MAXPOOL: window 8x8, stride 8, padding ‘SAME’
P1 = tf.keras.layers.MaxPooling2D(pool_size=(8, 8), strides=(8, 8), padding=‘same’)(A1)
## CONV2D: 16 filters 2x2, stride 1, padding ‘SAME’
Z2 = tf.keras.layers.Conv2D(filters = 16, strides = (1), kernel_size = [2, 2], padding = ‘same’)(input_img)
## RELU
A2 = tf.keras.layers.ReLU()(Z2)
## MAXPOOL: window 4x4, stride 4, padding ‘SAME’
P2 = tf.keras.layers.MaxPooling2D(pool_size=(4, 4), strides=(4, 4), padding=‘same’)(A2)
## FLATTEN
F = tf.keras.layers.Flatten()(input_img)
## Dense layer
## 6 neurons in output layer. Hint: one of the arguments should be “activation=‘softmax’”
outputs = tf.keras.layers.Dense(units=6, activation=‘softmax’)(F)
# YOUR CODE STARTS HERE
Model: “functional_15”
Layer (type) Output Shape Param #
input_9 (InputLayer) [(None, 64, 64, 3)] 0
flatten_8 (Flatten) (None, 12288) 0
dense_8 (Dense) (None, 6) 73734
Total params: 73,734
Trainable params: 73,734
Non-trainable params: 0
Test failed
Expected value
[‘Conv2D’, (None, 64, 64, 8), 392, ‘same’, ‘linear’, ‘GlorotUniform’]
does not match the input value:
[‘Flatten’, (None, 12288), 0]
AssertionError Traceback (most recent call last)
in
15 [‘Dense’, (None, 6), 390, ‘softmax’]]
16
—> 17 comparator(summary(conv_model), output)
~/work/release/W1A2/test_utils.py in comparator(learner, instructor)
20 “\n\n does not match the input value: \n\n”,
21 colored(f"{a}", “red”))
—> 22 raise AssertionError(“Error in test”)
23 print(colored(“All tests passed!”, “green”))
24
AssertionError: Error in test