Improvise_a_Jazz_Solo Ex 3

Any help i can’t figure out this
My code:

# Step 1: Use your inference model to predict an output sequence given x_initializer, a_initializer and c_initializer.
pred = inference_model.predict([x_initializer, a_initializer, c_initializer])
# Step 2: Convert "pred" into an np.array() of indices with the maximum probabilities
indices = np.argmax(pred, axis = -1)
# Step 3: Convert indices to one-hot vectors, the shape of the results should be (Ty, n_values)
results = to_categorical(indices, num_classes=None)

MY Output:

np.argmax(results[12]) = 75
np.argmax(results[17]) = 33
list(indices[12:18]) = [array([75]), array([11]), array([4]), array([79]), array([18]), array([33])]

Expected Output:
np.argmax(results[12]) = 26
np.argmax(results[17]) =7
list(indices[12:18]) =[array([26]), array([18]), array([53]), array([27]), array([40]), array([7])]

the Greader Comment
Code Cell UNQ_C3: Unexpected error (ValueError('operands could not be broadcast together with shapes (13,60) (13,90) ')) occurred during function check. We expected function predict_and_sample to return Test 3 failed. Please check that this function is defined properly.
If you see many functions being marked as incorrect, try to trace back your steps & identify if there is an incorrect function that is being used in other steps.
This dependency may be the cause of the errors.


When you post a question, please identify the week number and assignment number, or the name of the function you’re asking about.

I’m going to assume you’re asking about the “predict_and_sample() function”.

In “results = …”, why does your code say that the number of classes is “None”? You can’t do classification with no classes.

Got it. Thank you very Much.