Hi. I’m making the exercise that is on title. I searched for answers but I couldn’t find one.
[snippet deleted by mentor]
The error I’m receiving says that my the values inside my output are wrong when training=False
, although I don’t know if it will miss when it be true too.
Here is some of my code (I will make ):
normalization = BatchNormalization(axis=3)
relu = Activation('relu')
X = Conv2D(filter=F2, kernel_size=f, strides=1, padding='same', kernel_initializer=initializer(seed=0))(X)
X = normalization(X, training=training)
X = relu(X)
X = Conv2D(filters=F3, kernel_size=1, strides=1, kernel_initializer=initializer(seed=0))(X)
X = normalization(X, training=training)
X_shortcut = Conv2D(filters=F3, kernel_size=1, strides=s, kernel_initializer=initializer(seed=0))(X_shortcut)
X_shortcut = normalization(X_shortcut, training=training)
I didn’t put the code that I didn’t write
BatchNormalization
layer shouldn’t be shared across 2nd and 3rd components.
There is no function called normalization
in the notebook as given to us, so that must be something you created. Perhaps you didn’t define it correctly. The instructions tell us to use the BatchNormalization
function from TF and they even give us examples of how to call it in the template code. Your calls should look the same as those, although in some cases the input tensor is different.
It’s the name of the variable with value BatchNormalization(axis=3)
Like, doesn’t make a variable to be BatchNormalization(axis=3)
?
Ok that should be correct, if you specified the axis correctly. Notice that you’ve written it two different ways:
In the first post you show axis = True
.
In the later ones you show axis = 3
.
Please check that’s really 3.
I was the one who removed your image from the public post since you’re not allowed to share code in public.
As far as batch normalization is concerned, a new layer instance should be created. A layer is created when using something like Dense(...)
. When you call the layer with the parameters, like Dense(...)(...)
, the __call__
method is invoked.
One more mistake is that the shortcut path should not contain batch normalization after adding the intermediate results. Please see the image in the markdown above the exercise
Thank you! It worked. Sorry for sending the image