The code of you is correct but There are something note clear to me as the error of setting an array element with a sequence raise because of:
trying to create a jagged array
providing elements of incompatible types(that’s I think)
so that try to check you didn’t change the type of lists and didn’t change the cells before this cell, make sure you run the cells before it specially the library cell, and if the error is still you can get new fresh assignment by doing these steps:
file → open → select running assignment and doing shutdown and select all file and delete it → after that select help
@Daniel_Blossey,
Interesting!
I suspect your error has something to do with your environment - maybe version of TF you’re using, or something you loaded with a different def for sigmoid?
Here’s what I’m seeing when I run in the coursera environment:
My TF version is 2.8.0
When I added a print(z) as well as the print(g(z)) that you have, this is what the first pair of results looked like when I ran the “Quick Check” cell:
When I copy the code for the sigmoid function from autils and paste it in the assignment file (I put it in the same cell as my_dense, and re-executed that cell), the first pair of results look like this:
0.19
0.5473576181430894
I don’t understand why I’m seeing a tf.Tensor result when sigmoid is defined in autils, but just a scalar when it’s in the assignment file. I also have no idea why you’re seeing Tensor (no tf., like I see), and “Sigmoid:0” instead of the number I’m seeing.
I know this is not an answer to what’s going on in your environment, but this might give you some more info to help you track it down.
And… if you just want to get things working, it might be a work-around for you to copy the sigmoid function into your assignment file. Just remember to remove it before checking in your assignment, since they grader may be picky about it.
I think the notebook is pickup up an incompatible sigmoid() function.
I investigated a similar issue to this some time ago, and I found that the sigmoid() that’s being used isn’t the one from autils.py. It’s a sigmoid() function provided by TF.
So the error supports the theory that the issue is with the TensorFlow version.
Thanks for your answers! I have upgraded tensorflow from 1.15.5 to 2.8.0. But still the error appears if I would like to call the method “sigmoid” of file “autils.py”.
If I change the method name “sigmoid” to e.g. “sigmoid_123” in file “autils.py” my notebook cell works.
This is the photo of packages after I am also upgrade my tensorflow versions:
it’s seems different from you, you can use this command to upgrade the version of tensorflow of your environment
Even running the notebook in the Coursera Labs environment, I think the TensorFlow package is intercepting the call to the autils.py : sigmoid() function.
@TMosh, that sounds exactly right!
I took a quick look to see if I could find the culprit, and found this line in public_utils.py (which gets imported after autils.py): from tensorflow.keras.activations import sigmoid
But, regardless, it’s not really a good practice for autils.py to define a function with the same name as a function that could be imported from tensorflow, so I’ll submit a suggestion to the developers to rename the function in autils.py to something else that won’t clash, like, simple_sigmoid().