I’ve looked through many of the other issues other students were having, and I’m pretty sure my code should be correct. I’m using the x = X[:,t,:] slicing method, and the LSTM model is receiving the ‘a’ and ‘c’ that are updated at each iteration of the loop.
Initially when doing the unit test I got the error ‘reshaper has multiple inbound nodes’, which I fixed by restarting the kernel and clearing all outputs.
But now I have the error: “Error in test. The lists contain a different number of elements”.
At this point I’m not really sure what’s wrong, and I’m not sure which lists the error is referring to.
AssertionError Traceback (most recent call last)
in
1 # UNIT TEST
2 output = summary(model)
----> 3 comparator(output, djmodel_out)
~/work/W1A3/test_utils.py in comparator(learner, instructor)
16 def comparator(learner, instructor):
17 if len(learner) != len(instructor):
—> 18 raise AssertionError(“Error in test. The lists contain a different number of elements”)
19 for index, a in enumerate(instructor):
20 b = learner[index]
AssertionError: Error in test. The lists contain a different number of elements
Hey @cheberling,
I believe that the issue lies in step-2 of your implementation. Looks like you have altered the comment for step-2. The original comment is “Step 2: Loop from 0 to Tx”. Let us know if this resolves your issue.
I did not change the comment for step 2, and in fact the documentation above the function reads:
I followed the instructions I was given exactly. When I change the loop to start at 0, all tests passed. So it appears that you need to fix the instructions.
Hey @cheberling,
Apologies for the delayed response.
Apologies for that, that was a discrepancy on my end.
Actually, the issue lies in differences between the mathematical and programming conventions. In the markdown, the mathematical notation has been used, in which the indices starts from 1 and ends at T_x, including both. However, in programming, the indices starts from 0, so, we only need to take it up to T_x - 1.
Also, note that when we use range(1 , Tx), it doesn’t include Tx, so, this would be incorrect, as per the mathematical notation as well. To implement the mathematical notation, it should be range (1, Tx + 1), but in programming, we almost never do that. I assume you might have noticed this at multiple places throughout the specialization.