Hi!

In exercise4 where we are expected to implement the model by calculating and feeding the values of X,Y,a_prev,parameters and learning rate in the optimize function, I got this error:

**---------------------------------------------------------------------------**

**IndexError Traceback (most recent call last)**

** in **

**----> 1 parameters, last_name = model(data.split("\n"), ix_to_char, char_to_ix, 22001, verbose = True)**

** 2 **

** 3 assert last_name == ‘Trodonosaurus\n’, “Wrong expected output”**

** 4 print("\033[92mAll tests passed!")**

** in model(data_x, ix_to_char, char_to_ix, num_iterations, n_a, dino_names, vocab_size, verbose)**

** 64 # Perform one optimization step: Forward-prop → Backward-prop → Clip → Update parameters**

** 65 # Choose a learning rate of 0.01**

**—> 66 curr_loss, gradients, a_prev = optimize(X,Y,a_prev,parameters,0.01)**

** 67 **

** 68 ### END CODE HERE ###**

** in optimize(X, Y, a_prev, parameters, learning_rate)**

** 32 **

** 33 # Forward propagate through time (≈1 line)**

**—> 34 loss, cache = rnn_forward(X, Y, a_prev, parameters)**

** 35 **

** 36 # Backpropagate through time (≈1 line)**

**~/work/W1A2/utils.py in rnn_forward(X, Y, a0, parameters, vocab_size)**

** 94 x[t] = np.zeros((vocab_size,1))**

** 95 if (X[t] != None):**

**—> 96 x[t][X[t]] = 1**

** 97 **

** 98 # Run one step forward of the RNN**

**IndexError: only integers, slices ( :), ellipsis (...), numpy.newaxis (None) and integer or boolean arrays are valid indices**

I did not understood what to do so I just printed out the values of X and Y, as that’s the only calculation that I was supposed to perform and I got these values when I printed them out.

*X : [None, ‘t’, ‘u’, ‘r’, ‘i’, ‘a’, ‘s’, ‘a’, ‘u’, ‘r’, ‘u’, ‘s’]*

*Y : [21, 18, 9, 1, 19, 1, 21, 18, 21, 19, 0]*

Now, I am not able to figure out where is the problem in my code as I am able to perform the required calculation and the error is being thrown from a predefined function, so can somebody please help me with this.

Thanks in advance