Course5 w1 A1

{mentor edit: image of code removed - not allowed by the Code of Conduct}

hi! i am having trouble with that for some days and i cant pass it, so if someone can help i will appreciate!

can you send me a complete screenshot from starting exercise

i will try to solve

Your code for Exercises 1 and 2 seems correct to me. Have you changed anything outside of ### START CODE HERE ### and ### END CODE HERE###?

Learners are not allowed to share their code for the assignments. Please review the Code of Conduct.

I’ve edited the original post to remove the code.

no, i didnt change anything so i dont understand what is the problem. and i tried to submit as it was and for that error i got 0 so i am stuck!

The error message is pointing toward bad argument sizes in one of your calls to np.dot() within the rnn_cell_forward() function.

So that means one of these is the wrong shape:

  • Waa
  • Wax
  • xt
  • a_prev

In addition to the points that have been made above, here are a few more things to note:

You showed (and Tom deleted) the code for rnn_forward, but the failure you are showing is the test cell for rnn_cell_forward and the error is thrown in rnn_cell_forward. Meaning that the code you showed is not relevant to the failure.

The test code you show does not look like any of the tests for rnn_cell_forward that I see in the notebook or in the public_tests.py file. Here’s what the one visible test is that is given to you in the clean notebook:

np.random.seed(1)
xt = np.random.randn(3,10)
a_prev = np.random.randn(5,10)
Waa = np.random.randn(5,5)
Wax = np.random.randn(5,3)
Wya = np.random.randn(2,5)
ba = np.random.randn(5,1)
by = np.random.randn(2,1)
parameters = {"Waa": Waa, "Wax": Wax, "Wya": Wya, "ba": ba, "by": by}

a_next, yt_pred, cache = rnn_cell_forward(xt, a_prev, parameters)
print("a_next[4] = ", a_next[4])
print("a_next.shape = ", a_next.shape)
print("yt_pred[1] =", yt_pred[1])
print("yt_pred.shape = ", yt_pred.shape)

Notice that differs from the code you show in the error trace. In particular, note that the variables passed as the first two arguments to rnn_cell_forward are different in your code. Where in your code do x_tmp and a0_tmp get defined?

So how did that happen? Did you modify that test cell? If so, that is not a good idea. If the tests fail, the solution is not to change the tests. :nerd_face: Or perhaps you are using a very old version of the assignment that you copied from someplace? If so, that is also not a good idea and in that case, you should start by doing the “Get a fresh copy” procedure documented on this thread.

2 Likes

:+1: