I am getting the following error and i cannot figure out what is wrong with my code.
AssertionError: Wrong values when training=True.
For the second component of main path, I’ve got the following values: filter = F2, kernel size = f, stride =1, padding =same. batch norm on axis 3 and relu applied.
For third component, filter = F3, kernel size = 1, stride =1, padding =valid. batch norm on axis 3, no relu
For shortcut component, filter =F3, kernel size = 1, stride = s, padding = valid. batch norm on axis 3, no relu
The conv2d and batch norm is also applied to X_shortcut instead.
not sure what i am doing wrong. any help appreciated. thanks
Is this identity block or convolutional block code error?
please mention training=training for training to be true.
also if for convolution block, make sure in the second line of code for X_shortcut, you have recalled x as x but you need to recalled x as X_shortcut for instead of only (x)
the code given to me at the start of the code block was:
def convolutional_block(X, f, filters, s = 2, initializer=glorot_uniform): “”"
Implementation of the convolutional block as defined in Figure 4
Arguments:
X -- input tensor of shape (m, n_H_prev, n_W_prev, n_C_prev)
f -- integer, specifying the shape of the middle CONV's window for the main path
filters -- python list of integers, defining the number of filters in the CONV layers of the main path
s -- Integer, specifying the stride to be used
training -- True: Behave in training mode
False: Behave in inference mode
initializer -- to set up the initial weights of a layer. Equals to Glorot uniform initializer,
also called Xavier uniform initializer.
Returns:
X -- output of the convolutional block, tensor of shape (m, n_H, n_W, n_C)
i see that training is not included as an argument in the function. do i need to amend the function itself to include training?
Some changes have been made in the assignment recently, one of the major change being that the “training” parameter has been removed from Ex 1 and Ex 2
The code you shared above, the “training” parameter was left by mistake in the doc string of Ex 2. I apologise for the confusion it must have caused.
Also, ignore the screenshot @Deepti_Prasad shared above, as it is taken from the old version of the assignment.
I have just pushed a new update to this assignment (removing the “training” left in the doc string), this should provide you with the latest assignment version. Please work on that. Your previous solutions will still be valid as long as they don’t include the training parameter.
Even after this update, if find you still have the assignment version with training in the parameters for Ex 1 and Ex 2, please follow the instructions provided in order to get the latest assignment version.
Please let me know if you’d need any help,
Mubsi
@Deepti_Prasad, please take note of the changes that have been made.
Share your error log, yes these both block will pass without training parameters in the updated assignment.
You should make sure you used the correct kernel parameter mentioned in both the blocks. Try to refer the instructions mentioned before these block. Remember you identity block codes is dependent on convolution block.