W4 A1 Ex4 linear_activation_forward syntax

I’m stuck on this seemingly simple exercise. I have have no idea what is wrong with this entry for the sigmoid section:

# mentor edit: code removed

The errors I get provide no useful information. Please help. Thanks!

Please do not post your code on the forum. That’s not allowed by the Code of Conduct.
Just post a description of the issue, and images of the error messages.

I think they will be useful. Please post a screen capture image of the error messages.

(edited)

Actually, they gave us an implementation of sigmoid in dnn_utils.py that does return two values. The problem is the first line, which just has a dot product on the right side. That should be a call to linear_forward, which also returns two return values. They explained what to do in the instructions for the function linear_activation_forward. Why would we implement linear_forward and then not use it? :nerd_face:

Here’s the error message I get when I make the mistake that you made:

The error message is telling you that the line that throws the error does not make sense: the right hand side of that assignment statement contains only one value and you are assigning it to two values on the left hand side. Take a look at how we built the linear_forward function in the previous section. What does it compute and what does it return?

Thanks - I got it fixed. I’m able to follow the theory but keep getting tripped up in the way that this is all coded up and the use of functions that are not always covered in the lectures or notes. It’s not always easy to follow what is being asked for in the assignments even though I know it’s generally something pretty straight forward.

1 Like

The assignments don’t just recap the lectures, they also expand on the topic. You might consider them as extensions of the lectures.

Yes, as Tom points out, the assigments expand on the lectures and frequently include details about the implementation that were not covered in the lectures. It’s important to read all the instructions and explanations in the notebook carefully. They frequently give pretty complete hints in the template code, but if you try to “save time” by using those without reading the instructions you’re probably missing important and useful information.