Course 4, Week 1, Assignment 2, Ex. 1 Error in test

Hello everyone:

I’m trying to fix the below error:

[‘ZeroPadding2D’, (None, 70, 70, 3), 0, ((3, 3), (3, 3))]
[‘Conv2D’, (None, 64, 64, 32), 4736, ‘valid’, ‘linear’, ‘GlorotUniform’]
[‘BatchNormalization’, (None, 64, 64, 32), 128]
[‘ReLU’, (None, 64, 64, 32), 0]
[‘MaxPooling2D’, (None, 64, 64, 32), 0, (8, 8), (1, 1), ‘same’]
[‘Flatten’, (None, 131072), 0]
[‘Dense’, (None, 1), 131073, ‘sigmoid’]
Test failed
Expected value

[‘MaxPooling2D’, (None, 32, 32, 32), 0, (2, 2), (2, 2), ‘valid’]

does not match the input value:

[‘MaxPooling2D’, (None, 64, 64, 32), 0, (8, 8), (1, 1), ‘same’]

AssertionError Traceback (most recent call last)
in
12 [‘Dense’, (None, 1), 32769, ‘sigmoid’]]
13
—> 14 comparator(summary(happy_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

There error suggests i made a maxpooling botch which i thought i fixed but it may be that there are multiple errors in the code. Thanks in advance for any guidance you may be able to provide. - eddie

      # YOUR CODE STARTS HERE
        # ZeroPadding
        tfl.ZeroPadding2D(padding=(3,3),input_shape=(64,64,3)),
    
        ## cov2d
        tfl.Conv2D(32, (7, 7), strides = (1, 1)),
    
        ## batch
        tfl.BatchNormalization(axis=3),
    
        ## relu tf.keras.layers.ReLU()
        tfl.ReLU(),
    
        ## maxpool
        # tfl.MaxPool2D(pool_size=(8, 8), strides = (1, 1), padding = 'SAME'),
        tfl.MaxPool2D(pool_size=(2, 2), strides=None, padding='valid', data_format=None, **kwargs)
    
        ## flatten
        tfl.Flatten(),
    
        ## dense
        tfl.Dense(1, activation = 'sigmoid')

1

  1. Please do not post your code on the Forums. That’s not allowed by the Honror Code.

  2. Remove all of the arguments for your maxPool2D() function. The default arguments are all you need.

You’re also missing the comma from the end of that line of code.

Thanks for your quick response TMoshI will be more careful with the code next time. I fixed the code as per your instructions and it successfully executed. Thanks again!