C4W2 programing exercise:RES NETWORKS(the first one)

Now I have a problem that is tricky for me: reported an error in exercise 2 of the second week of lesson 4, but I watched my code over and over and it did follow the directions, to avoid a breach of honor Guidelines I can’t paste my own code, here is my error:
this is web: Residual Networks | Coursera

AssertionError Traceback (most recent call last)
Input In [32], in <cell line: 14>()
12 assert type(A) == EagerTensor, “Use only tensorflow and keras functions”
13 assert tuple(tf.shape(A).numpy()) == (3, 2, 2, 6), “Wrong shape.”
—> 14 assert np.allclose(A.numpy(), convolutional_block_output1), “Wrong values when training=False.”
15 print(A[0])
17 B = convolutional_block(X, f = 2, filters = [2, 4, 6], training=True)

AssertionError: Wrong values when training=False.

The second question is how to think about such problems in the future, and I hope someone can guide me.
thank you very much

Well, the above is what happened when I downloaded the lab’s content to run locally. I passed the test with full marks after moving the local code to the test, but why does this happen locally?

That was what I was trying to ask… Now, I fully understand the reason.

In your local environment, you probably use newer version of packages including tensorflow and others. In that case, behavior of GlorotUniform, an initializer for convolutional_block(), is different.
Of course, a recommended way is to downgrade several packages to be consistent to the Coursera platform.

But, this case is relatively easy.
At first, you need to remove glorot_uniform from the import list. Then, add this.

from tensorflow.python.keras.initializers.initializers_v2 import GlorotUniform as glorot_uniform

Please try this.

And, if you keep going on a local environment, similar problems are sure to occur. I have all assignments in my local PC, but also have several conda environments.
So, if you think everything should be correctly implemented but get an error, please try on the Coursera environment. Then, you can see what you should do next.

Hope this helps.

I use the Coursera platform to run my code.
I got the same error “Assertion error: Wrong values when training= False”.
not able to find the mistake, any suggestions would help me a lot.
Danke

I can tell you what I do when I can’t think of anything wrong, you can refer to:
Compare the code you typed with the above homework instructions line by line to see if you have not entered the correct code in any step.
It takes some patience.
Hope it can be useful to you.