The assertion error is triggered by yt_pred having a shape that is different from what is expected. So you need to check how yt_pred is calculated.
The parameter pass to np.dot in the softmax statement should be Wya and a_next, where a_next is the newly calculated hidden state. Please check the formula in Fig2 and also the instruction notes.
If your call to softmax followed the formula, then, I suggest you refresh the kernel and clear all output, and rerun the cells. This is to ensure your code is running in a clean state.
You can get another copy of the assignment by clicking the ?help button on the right corner. Do save a copy of your current file and rename it before hand just in case you want to make reference to it.
Are you getting the same results for y_pred as reported in your first post?
I tried to refresh the lab workspace but that did not work.
I also tried to rebooting and nothing happens.
Im always stuck with the same error.
This procedures are mantaining the saved changes from the last days.
Why I cant erase all that I’ve done until now and get a new notebook?
Did you open the ?help button and click on the get updated version?
That should give you a fresh copy of the original notebook. You should rename your current version before getting a fresh copy for reference purposes. When you got a fresh copy of the original notebook, type in the code, don’t cut and paste from your previous notebook.
You can post the code of that function by direct messaging. I will have a look for you.
Hi @Kic, I’m facing the exactly same error. I’ve double-checked the code, refreshed the kernel, nothing helped. Then I found out that the test passes fine if I assign y_pred to be not y_pred[:, :, t] but y_pred[:, :, t-1]. If I don’t do this minus 1, my y_pred result is somehow shifted +1 index to the right (see the picture below) and is not matching the expected result. Am I supposed to assign the t-1 position to y_pred or is it a bug? Assigning to t-1 seems illogical…
The values you showed here are not the same as the expected output.
If you have to change the time stamp, t, then there is something wrong with your code.
Put that section of your code and post a DM to me, I will have a look for you.
The code for rnn_cell_forward() where softmax is called with values returned from np.dot() has a problem:
The np.dot() call should have a_next as the second parameter.
Thank you very much.
I had the same value problem with the rnn_forward function.
I had incorrectly set a_prev in dot in softmax in the rnn_cell_forward function.
After correcting it to a_next, the test in the rnn_forward function worked correctly.
AssertionError Traceback (most recent call last)
in
16
17 # UNIT TESTS
—> 18 rnn_cell_forward_tests(rnn_cell_forward)
~/work/W1A1/public_tests.py in rnn_cell_forward_tests(target)
24 assert len(cache_tmp[3].keys()) == 5, “Wrong number of parameters in cache. Expected 5”
25
—> 26 assert np.allclose(np.tanh(parameters_tmp[‘ba’]), a_next_tmp), “Problem 1 in a_next expression. Related to ba?”
27 assert np.allclose(softmax(parameters_tmp[‘by’]), yt_pred_tmp), “Problem 1 in yt_pred expression. Related to by?”
28
AssertionError: Problem 1 in a_next expression. Related to ba?
Ive got this error. below is an ss of my code
{Codes removed by moderator as it’s against community guidelines, refrain from posting grader codes}
Thank you for pointing that out. I mistakenly used the same variables that were passed on in my function as arguments, in the formulas inside my function.
Sorry to bother you for such a noob issue on my part. Been scrutinizing my code for about two hours, though.