We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I could pass the test with my code and the solution code however the next code block always fails with the following:
--------------------------------------------------------------------------- IndexError Traceback (most recent call last) [<ipython-input-71-5b7b68580807>](https://n4nxjj8wuum-496ff2e9c6d22116-0-colab.googleusercontent.com/outputframe.html?vrz=colab-20230406-060150-RC00_522300627#) in <cell line: 4>() 4 for i, (input_idx, target_idx) in enumerate(zip(np.squeeze(x_batch), np.squeeze(y_batch))): 5 print("Step {:3d}".format(i)) ----> 6 print(" input: {} ({:s})".format(input_idx, repr(idx2char[input_idx]))) 7 print(" expected output: {} ({:s})".format(target_idx, repr(idx2char[target_idx]))) IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices
MY code (spoiler: not as elegant)
input_batch = np.array([]) output_batch = np.array([]) for x in range(batch_size): slice_end = idx[x] + seq_length input_batch = np.append(input_batch, vectorized_songs[idx[x]:slice_end]) output_batch = np.append(output_batch, vectorized_songs[idx[x] + 1: slice_end + 1])`
The text was updated successfully, but these errors were encountered:
It's been a while so I hope this is helpful. input_idx and target_idx are floats so you need to cast them into integers.
input_idx
target_idx
for i, (input_idx, target_idx) in enumerate(zip(np.squeeze(x_batch), np.squeeze(y_batch))): input_idx = int(input_idx) target_idx = int(target_idx) print(input_idx, target_idx) print("Step {:3d}".format(i)) print(" input: {} ({:s})".format(input_idx, repr(idx2char[input_idx]))) print(" expected output: {} ({:s})".format(target_idx, repr(idx2char[target_idx])))
Sorry, something went wrong.
No branches or pull requests
I could pass the test with my code and the solution code however the next code block always fails with the following:
MY code (spoiler: not as elegant)
The text was updated successfully, but these errors were encountered: