Hi!
The autograder fails me with the following in the optimize
function:
Code Cell UNQ_C3: Unexpected error (KeyError('da_next')) occurred during function check. We expected function `optimize` to return Test 3 failed. Please check that this function is defined properly.
I assume this is due to an extra parameter in utils.py
as the actual gradients
dictionary does not have a da_next
key. The key is mentioned in the backprop:
def rnn_step_backward(dy, gradients, parameters, x, a, a_prev):
gradients['dWya'] += np.dot(dy, a.T)
gradients['dby'] += dy
da = np.dot(parameters['Wya'].T, dy) + gradients['da_next'] # backprop into h
daraw = (1 - a * a) * da # backprop through tanh nonlinearity
gradients['db'] += daraw
gradients['dWax'] += np.dot(daraw, x.T)
gradients['dWaa'] += np.dot(daraw, a_prev.T)
gradients['da_next'] = np.dot(parameters['Waa'].T, daraw)
return gradients