Hey everyone. I face an error in exercise 3 in the linear_forward part. I am using np.dot(W,A) + b for getting the linear portion of the neuron calculations just like the previous assignments. I’m getting the correct output but I get test errors. Any ideas where I’m going wrong? There is a screenshot of the code below. Thanks in advance!
{moderator edit - solution code removed}
Hello Mahdi,
Welcome to the community.
Did your previous cell (initialize parameters deep) pass the test?
Sometimes, calling the wrong function throws error in latter cells. Check your previous cell once.
Also, It is against the honor code to share the code on community platform.
Hello Rashmi.
Thank you so much for your reply, and sorry about sharing my code, I wasn’t aware of it. Thank you for telling me. I can edit and delete the picture now if it’s necessary.
So, I checked my code and ran it again. All the previous cells from exercise 3 passed the tests and there are no errors. I think there has to be some problem with the tests in this exercise, and if I continue doing other exercises the errors trace back to this cell. I appreciate your help and time.
Here is what the template code looks like in a clean version of this notebook for the linear_forward
function:
#(≈ 1 line of code)
# Z = ...
# YOUR CODE STARTS HERE
# YOUR CODE ENDS HERE
cache = (A, W, b)
return Z, cache
Notice that you changed the code that sets the value of cache
. Why did you do that? That should not have needed to be changed.
Normally you only need to change the code in the “YOUR CODE HERE” sections. It’s not illegal to change other things, but you’d better make sure you know what you are doing when you change other things.
If you want to get a clean copy of the notebook to check the other things that you didn’t need to change, there is a topic about that on the DLS FAQ Thread.
Oh! You are right. I think I did it unintentionally by mistake.
Thank you for pointing it out.
I corrected it and there are no errors in the output now. I appreciate your help.