You don’t say which assignment you are talking about here but it looks like it might be the Residual Net assignment (ConvNet Week 2, Assignment 1).
Popular mistakes here are:
Forgetting to pass the “training” parameter on all that BatchNorm layers. They give you a sample of what the BatchNorm layers should look like in the template code. Yours should all look the same.
Not using the correct input values in the “Shortcut” section. If you used X as the input in that section, that will not end well …
paul - you are correct about the assignment - it is CNN week2 - first assignment Residual Networks.
I have taken care of all the points mentioned by you and checked the same a number of times. I am stuck !!!
I made changes in my shortcut section as Paul suggested it worked… might be helpful to take a look at these two lines as I passed X_Shortcut as my input here.
No, it’s a bug in your code: you are “hard-coding” the kernel_initializer values to the global value glorot_uniform. You should be using the “initializer” argument that was passed in. You may get lucky that it happens to match the parameters that the grader uses. The test in the notebook should also pass with that, because they do not pass that optional parameter and glorot_uniform is the default.
I see you even hacked the template code as well. They gave you a worked example of the correct code, but then you broke it.
Just for my ignorance - what is the difference between kernel_initializer and glorot_uniform? These terms have been used in the explanation document again and again
glorot_uniform is a function provided by TF. It is imported in the import cell that is the first executable cell in the notebook. Here is the documentation.
initializer is the variable name given to one of the optional parameters in the function definition of convolutional_block. The default value specified for that parameter is glorot_uniform.
kernel_initializer is the variable name of one of the optional parameters of the function Conv2D, which is also a TF function imported by the import cell in this notebook. Here is the documentation.
With the above in mind, now go take another look at the source for the convolutional_block function and it should make sense. But you probably first want to get a clean copy without your changes, because you have incorrectly modified the examples they gave you in the template code of how to correctly invoke Conv2D. There is a topic about that on the FAQ Thread.
The overall point here is that the variable initializer is the parameter to convolutional_block that should determine what initializer function is passed to Conv2D. But the way you have changed the code, it will always pass glorot_uniform, regardless of what value is passed in to convolutional_block at the top level. That is a bug, although it may not have any ill effect as long as you don’t try to use a different initializer than glorot_uniform.