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)
2
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:
81
---> 82 print('Iteration: %d, Loss: %f' % (j, loss) + '\n')
83
84 # The number of dinosaur names to print
TypeError: only size-1 arrays can be converted to Python scalars