Hi, I am facing a test failed error in programming assignment of week 2 of Convolutional neural network course in which the Model summary of my model isi shown as
[‘TFOpLambda’, (None, 15, 15, 256), 0]
while the expected is :
[‘Add’, (None, 15, 15, 256), 0]
how to rectify this error as the grader shows incorrect implementation of the ResNet50 model
Got it. After looking at the complete summary i realized that in the identity block instead of using the Add() function, i had simply used the ‘+’ operator. Thanks for the help .
Yes, the two operations are equivalent, but the way the tests work here is that they do a literal compare of the “summary” output, so you have to use the exact function that they tell you to use in the instructions. Just being logically correct isn’t good enough.
But they did their best to help you out here by being very explicit in the instructions about how to implement that logic.
But one thing that’s bugging me is upon using ‘+’ operator the accuracy of the model upon training is 0.7666666507720947 while using Add() function gives accuracy of 0.7083333134651184. I’ve tried it more than once but same results.
Also note that even if you use Tom’s method to always start from the same state, the results still are not deterministic even if you don’t change the code. I ran it three times from the “reset” state with the Add() implementation and got three different values for the Test Accuracy:
0.85
0.866666
0.766666
Even when you set the random seeds for the PRNG algorithms, the results are still not deterministic, because the training is parallelized across multiple CPUs and GPUs. Parallelism is inherently non-deterministic, since exactly how the threads get scheduled depends on everything ele that’s happening on the computer at the same time. There are ways to artificially constrain that to be deterministic, but then you lose most of the advantages of parallelization and it really costs you in terms of performance. Here’s a thread from mentor Raymond which discusses this point in a lot more detail.