Week1 Jazz Improvisation with LSTM (Exercise 2)

I faced to the following error, probably I might define “depth” in one_hot(), however, I don’t understand what does depth mean in this context.

TypeError Traceback (most recent call last)
----> 1 inference_model = music_inference_model(LSTM_cell, densor, Ty = 50)

in music_inference_model(LSTM_cell, densor, Ty)
50 # See instructions above.
51 x = tf.math.argmax(out)
—> 52 x = tf.one_hot(x)
53 # Step 2.E:
54 # Use RepeatVector(1) to convert x into a tensor with shape=(None, 1, 90)

/opt/conda/lib/python3.7/site-packages/tensorflow/python/util/dispatch.py in wrapper(*args, **kwargs)
199 “”“Call target, and fall back on dispatchers if there is a TypeError.”""
200 try:
→ 201 return target(*args, **kwargs)
202 except (TypeError, ValueError):
203 # Note: convert_to_eager_tensor currently raises a ValueError, not a

TypeError: one_hot() missing 1 required positional argument: ‘depth’

You need to specify that depth is n_values.
The depth is the number of categories.

1 Like

Thank you very much for your advice.
Finally, after fix another issue, I can path!

2021年7月21日(水) 10:46 Tom Mosher via DeepLearning.AI <dlai@discoursemail.com>: