You are right. Not including a lecture note or instruction about this isn’t very nice. Sending students off to look at external documentation that also doesn’t include it is extra not nice. REQUEST for admins: please include a note in the lab notes saying that input_size = [list] IS an acceptable (and here, necessary) argument for tfl.ZeroPadding2D(). Thank you!
in happyModel()
20 model = tf.keras.Sequential([
21 ## ZeroPadding2D with padding 3, input shape of 64 x 64 x 3
—> 22 tfl.ZeroPadding2D((3,3))(input_shape = (64, 64, 3)),
23 ## Conv2D with 32 7x7 filters and stride of 1
24 tfl.Conv2D(32, 7, stride = 1)(input_shape),
ValueError: The first argument to Layer.call must always be passed.
I got this error but I don’t understand what it’s means.
Two parameters are needed to pass as arguments into ZeroPadding2D. From the way you code it, you have only passed one parameter, even though you have somehow put two things in that line. Here is how we should define a layer:
You have the right name for “input shape”, and you can look up the argument name for padding size from the layer’s documentation. Please check the other layers as well in the same way (both how many arguments are needed and their argument names)
It’s great to hear that you managed to fix it! The way you have done it is slightly different from the exercise’s description because you have added an “Input Layer” to specify the input_shape. You could have specify “input_shape” in the first layer of your Model, which is ZeroPadding2D, but either way will work because both of them lets your model know what the expected input shape is. Note that we only need to specify the input_shape once, and the model will figure out the other layers’ input shape automatically.
Cheers,
Raymond
PS: I have removed your solution code since we can’t share it here.