DLS C5W1A2E4, Type Error

Course 5, Week 1, Assignment 2, Exercise 4:
I am unable to sport any error in my code and I seem to have the dimensions correct as well.

UPDATE: loss returned by get_initial_loss() has a shape mismatch with curr_loss returned by optimize(). What I dont understand is that I have all the test cases passed for previous exercises.

TypeError                                 Traceback (most recent call last)
<ipython-input-18-725c093d6b91> in <module>
----> 1 parameters, last_name = model(data.split("\n"), ix_to_char, char_to_ix, 22001, verbose = True)
      3 assert last_name == 'Trodonosaurus\n', "Wrong expected output"
      4 print("\033[92mAll tests passed!")

<ipython-input-17-34a3fa0827ef> in model(data_x, ix_to_char, char_to_ix, num_iterations, n_a, dino_names, vocab_size, verbose)
     80         if j % 2000 == 0:
---> 82             print('Iteration: %d, Loss: %f' % (j, loss) + '\n')
     84             # The number of dinosaur names to print

TypeError: only size-1 arrays can be converted to Python scalars

Hi @Bunny ,

The X, Y parameters passed to the optimize() are constructed in the model(). If they are constructed incorrectly, it would have an effect on the curr_loss returned. There are debugging statements in model() that helps to check if X and Y are formed correctly, what are the print out values?