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 parameters = model(data, ix_to_char, char_to_ix)
3 assert last_name == ‘Trodonosaurus\n’, “Wrong expected output”
4 print(“\033[92mAll tests passed!”)
in model(data, ix_to_char, char_to_ix, num_iterations, n_a, dino_names, vocab_size)
50 # Perform one optimization step: Forward-prop → Backward-prop → Clip → Update parameters
51 # Choose a learning rate of 0.01
—> 52 curr_loss, gradients, a_prev = optimize(X, Y, a_prev, parameters, learning_rate = 0.01)
53
54 ### 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)
100
101 # Update the loss by substracting the cross-entropy term of this time-step from it.
→ 102 loss -= np.log(y_hat[t][Y[t],0])
103
104 cache = (y_hat, a, x)
IndexError: index 46 is out of bounds for axis 0 with size 27