When trying to run the code of exercise 4 in the dino assignment, I get the following error message:
TypeError: only size-1 arrays can be converted to Python scalars
I feel that this must be coming from the shape of X and Y, which are both lists, with length of 2, but the following format:
X : [[None], [list of integers]]
Y: [[list of integers], [0]]
Here is my code for both:
# Set the input X (see instructions above)
single_example = examples[idx]
single_example_chars = [c for c in single_example]
single_example_ix = [char_to_ix[c] for c in single_example_chars]
X = [None] + [single_example_ix]
# Set the labels Y (see instructions above)
# For example, Y[0] contains the same value as X[1]
ix_newline = char_to_ix['\n']
Y = copy.copy(X[1:]) + [ix_newline]
I have tried restarting the kernel, clearing all and rerunning already.
Can you please help?
Thank you!