Week 1 Assingment Model_Application

I use lots of shape and i also did various command but code still not ran if you known please help i stuck .
input_img = tf.keras.Input(shape=input_shape)
## CONV2D: 8 filters 4x4, stride of 1, padding ‘SAME’
Z1 = tf.keras.layers.Conv2D(8, kernel_size = (4, 4), strides = (1, 1), padding = ‘SAME’)(input_img),
## RELU
A1 = tf.keras.layers.ReLU(Z1),
## MAXPOOL: window 8x8, stride 8, padding ‘SAME’
P1 = tf.keras.layers.MaxPool2D((8,8), (8,8) , padding = ‘SAME’),
## CONV2D: 16 filters 2x2, stride 1, padding ‘SAME’
Z2 = tf.keras.layers.Conv2D(16,kernel_size = (2,2), strides = (1,1) , padding = “SAME”),
## RELU
A2 = tf.keras.layers.ReLU(Z2),
## MAXPOOL: window 4x4, stride 4, padding ‘SAME’
P2 = tf.keras.layers.MaxPool2D((4,4),(4,4) , padding = ‘SAME’),
## FLATTE
F = tf.keras.layers.Flatten()(P2),
## Dense layer
## 6 neurons in output layer. Hint: one of the arguments should be “activation=‘softmax’”
outputs = tf.keras.layers.Dense(6, activation=‘softmax’)(F)
# YOUR CODE STARTS HERE
the code is here please tell me what is the worng
The error was : - TypeError: ‘<’ not supported between instances of ‘tuple’ and ‘float’

Starting from “P1 = …”, all your layers are missing the data arguments.

input_img = tf.keras.Input(shape=input_shape)
## CONV2D: 8 filters 4x4, stride of 1, padding ‘SAME’
Z1 = tf.keras.layers.Conv2D(8, kernel_size = (4, 4), strides = (1, 1), padding = ‘SAME’)(input_img),
## RELU
A1 = tf.keras.layers.ReLU(Z1),
## MAXPOOL: window 8x8, stride 8, padding ‘SAME’
P1 = tf.keras.layers.MaxPool2D((8,8), (8,8) , padding = ‘SAME’)(A1),
## CONV2D: 16 filters 2x2, stride 1, padding ‘SAME’
Z2 = tf.keras.layers.Conv2D(16,kernel_size = (2,2), strides = (1,1) , padding = “SAME”)(P1),
## RELU
A2 = tf.keras.layers.ReLU(Z2),
## MAXPOOL: window 4x4, stride 4, padding ‘SAME’
P2 = tf.keras.layers.MaxPool2D((4,4),(4,4) , padding = ‘SAME’)(A2),
## FLATTE
F = tf.keras.layers.Flatten()(P2),
## Dense layer
## 6 neurons in output layer. Hint: one of the arguments should be “activation=‘softmax’”
outputs = tf.keras.layers.Dense(6, activation=‘softmax’)(F)
# YOUR CODE STARTS HERE

I gave data aruguments but not ran gave same error Please help.

I faced the same problem, remove the ‘,’ also ReLU(Z1) —> ReLU()(Z1)

1 Like