Hello fellow learners,
I have an issue with week 2 Exercise 1. I have written the code for the exercise, but if I run the cell below, which is supposed to verify my output the following line throws an error:
tf.keras.backend.set_learning_phase(False)
The error is the following:
AttributeError: module 'keras._tf_keras.keras.backend' has no attribute 'set_learning_phase'
A quick research gave me the hint that this function was removed in keras version 2 and upwards.
Installing an older version of keras with
pip install tensorflow==1.15.0
was not successfull, as it is not available.
Since the validation-code blocks throw an error, the grader doesn´t accept my submission.
Is there anything I can do about it?
First, you shouldnât do that. If your code throws an error, it is most likely that your code is incorrect, not something wrong with the grader or version. So, you should revert to the original version of the assignment. I guess restarting your assignment may use the original version but if that is not true, check this on how to get a clean copy of your assignment.
Regarding your error, in Exercise 1 - identity_block
, double check your filters
, kernel_size
, strides
, and padding
for each component. Also, check your final step: # Final step: Add shortcut value to main path(Use this order [X, X_shortcut]), and pass it through a RELU activation (â2 lines)
1 Like
Are you running this assignment on the course website or on your local computer? I tried it again just to refresh my memory and had no problem with the set_learning_phase issue on the course website. The version of TF is shown in this screenshot (I added the cell to print the version):
If you add that cell to your notebook, what do you see?
@paulinpaloalto P.s. this morning at first I was thinking the same thing too (that maybe they are running locally, or where do you get pip ?!?) â But @saifkhanengr helpfully showed me there actually is a way to run pip in our Coursera Colab notebooks.
I did not know that .
Right, the notebooks are running in Docker images, which are a particular type of simplified Linux Virtual Machine, so youâve got as much of linux underneath you as the creators of the assignment installed in their VMs. They are trying to keep the images reasonable in size, so you donât have everything possible, but thereâs quite a lot there. The syntax in Jupyter to run a linux command is to preface it with an exclamation point (bang!).
So try saying â!ls -lRâ or â!pwdâ in a code cell and watch what happens.
1 Like