That’s an easy part. In the case of GlorotNormal and GlorotUniform, you need to import this version. Then, it runs on TF2.8 or even TF2.9, which is my environment.
from tensorflow.python.keras.initializers.initializers_v2 import GlorotNormal as glorot_normal
As Tensorflow deletes a reference to tensorflow.python after “__init__()”, using tensorflow.python.keras.initializers.initializers_v2.GlorotNormal() inline may not work.
It is always a good thing to check with the Coursera environment, of course.
Hi, Paul,
I do see your point. Having to list all versions of packages kind of defeats the purpose of the browser-ready environment, which is the only environment that Coursera should have to be responsible for. It’s not just only Tensorflow that may change, but even Python itself. So my hindsight reasoning is flawed. I found some value in the other questions about running in one’s own environment, which I’ll continue to do since it gives me greater latitude to try out ideas while exploring the notebooks. But, in the end, the code that counts is in the browser.
Thanks,
Marty
Hi, Nobu,
Thanks for the tip, but adding the import code for GlorotNormal still lead to the same error. I’ll just have to use my environment when I can, but ultimately do my assignment in the browser, which is basically sandboxed.
Regards,
Marty
ultimately do my assignment in the browser, which is basically sandboxed.
That’s really good thing, since you need to submit an assignment anyway…
By the way, did you import GlorotNormal like this ?
from tensorflow.python.keras.initializers.initializers_v2 import GlorotNormal as glorot_normal
in initialize_parameters()
initializer = glorot_normal(seed=1)
I made all assignments run in my local environment, although some require different conda environment due to dependencies to other packages like music21 or particular version of Python, …
The drawback is,… the above may not work in the Coursera environment…