hello everyone. I am having trouble in 'jazz Improvisation with LSTM" exercise no 3
The step 2d States this:
Convert the last output into a new input for the next time step. You will do this in 2 substeps:
Get the index of the maximum value of the predicted output using tf.math.argmax along the last axis.
Convert the index into its n_values-one-hot encoding using tf.one_hot .
My code for that step is:
x = tf.math.argmax(out,axis = ?)
x = tf.one_hot(x)
I am having trouble to set the last axis to which i get the following error:
“Attempt to convert a value (<tensorflow.python.keras.layers.core.Dense object at 0x7f153e5fd2d0>) with an unsupported type (<class ‘tensorflow.python.keras.layers.core.Dense’>) to a Tensor.”
Remember that selecting the last index in Python can be done by using -1 (as opposed to 0, 1, 2, 3, ... or whatever the last index might be when counting from 0 and up).
For the tf.one_hot() call, I suggest you search other posts in this forum for the depth parameter. That definitely helped me in solving the Assignment