I am obtaining a list index out of range error when calling the optimization function optimize(X, Y, a_prev, parameters, learning_rate = 0.01) from the model() function. The error seems to be in the rnn_forward call when calculating the loss -= np.log(y_hat[t][Y[t],0]).

I am unsure how passing the optimize function parameters is giving a list index out of range error?

thank you