I have some problems with W2 Residual Networks lab

I think I followed all the instructions but still got error

stride = 1 for all 3 steps, paddings are valid,same,valid

Could you please help me?

Other issues to check are the filter values, and how you implemented the shortcut.

It looks like that filter values are straightforward since the code already contains

F1, F2, F3 = filters

I just used these 3 for every step.

So, most probably i missed something in shortcutting…

I do this in the last raw of my code.

X = Add()([X, X_shortcut])

after the relu activation in the previous line

The F1, F2 and F3 values tell you the number of filters (output channels) at the various layers, but you also need to worry about the filter sizes (kernel size), right? The instructions also tell you those values. They are not the same at all layers …

I think that’s the problem.

I can’t find any words in the instructions describing kernel_size. I just set it to = 1 for all three steps. Could you please show me the place where it is described?

if I change places of Add() and relu activation to this

X = Add()([X, X_shortcut])
X = Activation(‘relu’)(X)

I just get the error from my first message

After figure 4, after the line “These are the individual steps:”, there are three sections of text that describe each of the components, including the kernel_size, strides and padding.

Since the error message you posted had hinted about strides and padding, and that you might have missed some details in the text aforementioned (like the kernel_size), you probably want to read it again in detail and see if the 9 setting values (3 components x (kernel_side + padding + stride values)) in the text all match with yours.

Cheers,
Raymond

This code is correct. So the issue lies elsewhere.

Ok, thank you! Finally, I managed to find the issue. Thanks for your support guys.

1 Like

That’s good news!

I assume you’ve already found this (since you’ve passed the grader) and sorry that I missed your post earlier in all the hubbub on this thread, but here it is:

Second component of main path:

* The second CONV2D has 𝐹2�2 filters of shape (𝑓,𝑓)(�,�) and a stride of (1,1). Its padding is "same". Use 0 as the seed for the random uniform initialization: `kernel_initializer = initializer(seed=0)`.

Filters of shape (f, f) is the point there.

Thanks for your response anyway :slight_smile: