I have a doubt regarding the last assignment of Week 1.
When defining the model, we are required to specify an input shape of 64 x 64 x 3.
However, it is unclear to me how to do this. Obviously, I have looked at the documentation (tf.keras.layers.ZeroPadding2D | TensorFlow Core v2.4.1) and Googled quite a bit, but would appreciate some pointer or some understanding of what is going on because I have been stuck here for the whole afternoon.
But how can you explain this usage of a class y = tf.keras.layers.ZeroPadding2D(padding=1)(x)
taken from tensorflow documentation
I mean : ZeroPadding2D is a class, so with any class (say ‘y’), we can use : y(some args) to instantiate an object of the class type.
But what does this → y(some args)(something) mean?
@ashish_learns you will understand this while doing assignment of functional model. Actually it is like pipeline, in y = tf.keras.layers.ZeroPadding2D(padding=1)(x) assume x as a input that come from previous layer and in next layer, let suppose z = tf.keras.layers.MaxPool2D(pool_size=(2, 2), strides=None, padding='valid')(y) will be placed on x.
Okay.
I have been using Python for more than 4 years and have never come across this type of programming construct, where apart from the usual () for instantiating object of a class, we also have an extra () just after this —> tf.keras.layers.ZeroPadding2D(padding=1)(x)
I would suggest this info be added to the assignment as a hint. There is no way we could find out that input_shape is a parameter, other than guessing, or hoping to find it here. I spent a lot of time trying to figure out how to make it work, only to find out there is some hidden parameter to use that’s not in the docs.