W2A1 ResNets Lab Assignment

In the section “Building Your First ResNet Model (50 layers)”, stage 1 after padding with shape (3,3) the shape is (None, 70, 70, 3). However the filter dimension in

X = Conv2D(64, (7, 7), strides = (2, 2), kernel_initializer = glorot_uniform(seed=0))(X)

is just (7x7x64). The number of channels in input image must match that of the filter but that does not seem to be the case here. Am I missing something?

The first argument filters gives the number of filters in the layer you are specifying. Then kernel_size gives you the height and width of those filters. You don’t need to specify the input channels, since that is implicit: each of the filters in the current layer need to match the number of channels in the input. So with the parameters specified, each filter will be 7 x 7 x 3 and there are 64 of them, so the W tensor will have shape 7 x 7 x 3 x 64.

For more info and examples, see the documentation for Conv2D.

1 Like

Thank you very much. I am satisfied with your answer.