A3: music_inference_model()

Step 2.D:

    # Select the next value according to "out",
    # Set "x" to be the one-hot representation of the selected value
    # See instructions above.

Isn’t the input of the current time step the output of the previous step? If so, x is set to out? Then when calling tf.one_hot(), indices(first argument) must be x and the second argmax of out? I get an error:
TypeError: Value passed to parameter ‘indices’ has DataType float32 not in list of allowed values: uint8, int32, int64

Any clues are appreciated.

Your first argument is correct but the second argument is a depth of your one-hot vector and it is a scaler.

Hint for a second argument (from notebook):

  • Convert the index into its n_values-one-hot encoding using tf.one_hot.

depth of one-hot vector? is it n_values?

Yes.

Thanks. Then I get this error when I run music_inference_model()

AssertionError: Error in test. The lists contain a different number of elements

Your code might be wrong. Please revisit the instructions and compare your code with it. If still facing any issue, please share full error.

Here is the full error:

AssertionError Traceback (most recent call last)
in
3 # UNIT TEST
4 inference_summary = summary(inference_model)
----> 5 comparator(inference_summary, music_inference_model_out)

~/work/W1A3/test_utils.py in comparator(learner, instructor)
16 def comparator(learner, instructor):
17 if len(learner) != len(instructor):
—> 18 raise AssertionError(“Error in test. The lists contain a different number of elements”)
19 for index, a in enumerate(instructor):
20 b = learner[index]

AssertionError: Error in test. The lists contain a different number of elements

I think I figured it out. thanks for the help tho.