Hmmm, my code looks the same as yours as far as I can see from what you posted. My guess is that the error is not to do with the AveragePooling layer, but maybe something you did differently in either the identity block or the conv block. Are you sure your code passes all the “unit tests” there? Note that the “Add” block that it’s complaining about only happens in the “shortcut” layers of both the identity block and the conv block. That’s why I suspect something is wrong there, rather than in ResNet50, but that the unit tests aren’t catching it …
This turns out to be a case in which the test failure is on ResNet50, but the bug it’s pointing to is actually in the identity_block routine. Notice that it’s telling you that it didn’t like the “Add” layer there. Check to make sure that you followed the directions in which they specifically said to use the “Add()” function. They also give you a worked example of how to do this in the template code for the convolutional_block function.
Hi Paul,
Thank you very much for your kind support. I have solved the error. I would like to connect with you on LinkedIn also. It would be great if you share your Linkedin profile.
/tf/W2A1/test_utils.py in comparator(learner, instructor)
21 “\n\n does not match the input value: \n\n”,
22 colored(f"{a}", “red”))
—> 23 raise AssertionError(“Error in test”)
24 print(colored(“All tests passed!”, “green”))
25
This is an exercise in proofreading and I guess checking “many times” is not quite enough. Your filters are not the same as the instructions ask for in Stage 5 on the convolutional block.
/tf/W2A1/test_utils.py in comparator(learner, instructor)
21 “\n\n does not match the input value: \n\n”,
22 colored(f"{a}", “red”))
—> 23 raise AssertionError(“Error in test”)
24 print(colored(“All tests passed!”, “green”))
25
@Murat_Hamarat Are you sure you have carefully checked the parameters on all your added layers against the instructions? This whole assignment is an excruciating exercise in proofreading.
Hi Paul,
Thank you so much for your support on this. I made a similar mistake in identity_block of using+ instead of Add function, and the test is passed so I didn’t realized the mistake until I saw your response. Thanks!
I have checked countless times about my previous implementation. I passed all the tests for the previous 2 functions, and I used the Add function as well, but still, I’m getting this error message.
Are you sure that all your implementations of Add() use that code instead of a more generic implementation? The error message is pretty specific. If you check carefully, you should be able to map that to exactly which layer it is. Look at the “summary” output and find that layer.
The other thing to realize is that just typing new code and then calling the cell again does nothing: it runs the old code again. You actually have to click “Shift-Enter” on the changed cell in order for the new code to get interpreted into the runtime JIT image. Or doing “Kernel → Restart and Clear Output” followed by “Cell → Run All” will do it.
Note that the bug is not in the resnet50 routine: it’s in either identity_block or convolutional_block, because that is where the Add() operations are for the shortcut layers. Follow the first part of this thread: it sounds like your mistake is the same as Rahul’s.