Hello!
When the tests run my implementation ofrnn_forward
, they print:
a[4][1] =
[-0.93013738 0.991315 -0.98694298 -0.99723276]
, which doesn’t match the expected output.
… and indeed there’s this assertion error: AssertionError: Wrong values for a
.
Below is how I’ve implemented rnn_forward
. I’ve looked over it many times, and read related threads, but I’m not seeing what I’m doing wrong.
Please tell me what I’m doing wrong, DMing me if you can’t share it here.
Thanks!
PS. One thing I’m finding a bit confusing, is that:
- in the diagram, xt is 1-indexed (while at is 0-indexed);
- but when I call
rnn_cell_forward
insidernn_forward
, I usex[:,:,t]
as the first argument (so, x[:,:,0] during the loop’s first iteration), and ,a_next
as the second argument (which isa[:, :, 0]
on the loops’ during the loop’s first iteration). i.e. I’m using the same number of index into both x and a, without an offset, which seems wrong. - But if I use
x[:,:,t + 1]
as the first argument, t + 1 gets out of bound (error:index 4 is out of bounds for axis 2 with size 4
).
How I’ve implemented rnn_forward
### START CODE HERE ###
# moderator edit: code removed
### END CODE HERE ###