Week-1: Programming Assignment: Building your Recurrent Neural Network - Step by Step

I am getting this error in Exercise 6 - rnn_backward
“TypeError: cannot unpack non-iterable NoneType object”
image

Please help me

Hi @imran_rimon, the error message typically occurs when the function you are calling is not returning a value. Did you edit rnn_backward and accidentally remove the return statement at the end?

No
I didn’t remove anything. I checked it multiple times.

Maybe you didn’t remove the return statement, but instead you modified the indentation in such a way that the return statement is no longer part of the function. Indentation is part of the syntax in python, of course. Put a print statement right before the return at the same indentation level. Does that print statement execute when you call the function?

No, It doesn’t print statements. I checked that also.

Maybe I’m just not understanding what you’re saying, but if the print statement doesn’t execute then I’d say it’s is showing that my theory is right and you need to figure out why not. This is how debugging works: one step at a time. Come up with a theory: run the experiment. Does it prove or disprove the theory?

1 Like

Hi! Im having the same problem. Return is inside the function and indentation is fine. I don’t know if i’m missing something here…

Hi @dvinagres ,

Please start a fresh query with error traceback and as much information as possible. The mentors will help diagnose what the problem might be.

1 Like

Yes, as Kin says, seeing the full exception trace would be the best way to debug. If what you are seeing is literally the same as the earlier one on this thread, notice that it means the first element of caches, which is to say caches[0], ends up being None. So then you have to track backwards to see where that value came from. Why is it wrong? And note that the previous statement that extracted caches did not “throw”.

This is an example of how to start the debugging process: you have to get as much information as you can from the evidence of what actually happened. Understanding what the error message actually means is the critical first step. Then you peel the onion from there …

1 Like

I see it now… Thank you so much :face_holding_back_tears: