W1 Lab3 reshaping X

In exercise 1, we reshaped input X to be a one-dimensional vector using the reshaper function, why don’t we follow the same procedure in exercise 2 when we are working on music_inference_model function?

Hello, @mmorello,

Please add two tf.print('before', x.shape) and tf.print('after', x.shape) before and after the line for the reshaper, because its job was to reshape x from (None, n_value) to (None, 1, n_value). In other words, it increases x by one dimension.

We needed the reshaper because LSTM needs to accept a 3-dimensional x of the shape (number of samples, number of time steps, n_value).

Because the x in exercise 2 is already in the shape of (None, 1, n_value).

Cheers,
Raymond

2 Likes