Convolutional Neural Network (1 week, 2nd programming exercise)

Hello,

At the end of the second programming exercise I am getting the following error:

TypeError: init() got multiple values for argument 'activation’

The my code is as follows. Please, I need some help:

input_img = tf.keras.Input(shape=input_shape)

Z1 = tfl.Conv2D(filters = 8, kernel_size = (4,4) ,strides = (1,1), padding = “SAME”)(input_img)

A1 = tfl.ReLU()(Z1)

P1 = tfl.MaxPool2D(pool_size = (8,8), strides = (8,8), padding = “SAME”)(A1)

Z2 = tfl.Conv2D(filters = 16, kernel_size = (2,2), strides = 1, padding = “SAME”)(P1)

A2 = tfl.ReLU()(Z2)

P2 = tfl.MaxPool2D(pool_size = (4,4), strides = (4,4), padding = “SAME”)(A2)

F = tfl.Flatten()(P2)

outputs = tfl.Dense(F, 6, activation =“softmax”)

model = tf.keras.Model(inputs=input_img, outputs=outputs)
return model

1 Like

The Dense layer should be added with the previous layer, similar to how you did for all those other layers. For example, F = Flattern()(previous_layer)

1 Like

Thanks so much! I solve it right after posting, but thanks anyway :slight_smile: