I’ve finished this assignment without experiencing any problem. Then, I want to do some experiment on my computer but I have some issues to run the code. I think using a different Keras version is producing an error. I have the Keras version 3. On Coursera, the version is 2. A screenshot of this issue is here:
Since the Coursera course uses Keras 2, the easiest solution is to downgrade Keras to version 2: pip install keras==2.11.0. Make sure to restart your kernel after downgrading.
If you prefer to keep Keras 3, try wrapping vu in a Lambda layer instead of using tf.linalg.l2_normalize directly. For example:
from tensorflow.keras.layers import Lambda
vu = Lambda(lambda x: tf.linalg.l2_normalize(x, axis=1))(vu)
For those who want to keep Keras 3 like me I’d like to remind that you also require to replace all layer.output.shape.as_list() with list(layer.output.shape) in the public_tests.py file.