Music_RNN_RBM
Music_RNN_RBM copied to clipboard
ValueError: The shape for while_1/Merge_2:0 is not an invariant for the loop. It enters the loop with shape (1, 100), but has shape (?, 100) after one iteration. Provide shape invariants using either the `shape_invariants` argument of tf.while_loop or set_shape() on the loop variables
I tried running your code with slight tweaks which are no way related to this part but this doesnt seem to be working .
`
Uarr = tf.scan(rnn_recurrence, x, initializer=u0)
U = Uarr[int(np.floor(prime_length / midi_manipulation.num_timesteps)), :, :]
time_steps = tf.constant(1, tf.int32)
iterations = tf.constant(num)
u_t = tf.zeros([1, n_visible], tf.float32)
music = tf.zeros([1, n_visible], tf.float32)
loop_vars = [time_steps, iterations, U, u_t, x, music]
[_, _, _, _, _, music] = tf.while_loop(lambda count, num_iter, *args: count < num_iter, generate_recurrence,
loop_vars, shape_invariants=[time_steps, iterations,
U, u_t,x, tf.TensorShape([1, 15600])])
return music`
Doesn't that message come from using tf.while_loop() ? I had similar message, so I gave 'shape' info after 'variable' in tf.while_loop() And, it is probably because 'music' gets concatenated every loop. So it's shape changes, eventually it will become 'num_iter' x 'n_visible' size...
@junwoo091400: Are you saying that you've specified the 'shape_invariants' after the 'loop_vars' in the while_loop? Or have you changed something else?
I ask only because I tried adding the 'shape_invariants' but I still get the same problem.
I used
loop_vars = [time_steps, iterations, U, u_t, x, music] [_, _, _, _, _, music] = tf.while_loop(lambda count, num_iter, *args: count < num_iter, generate_recurrence, loop_vars, shape_invariants=[time_steps.get_shape(), iterations.get_shape(), U.get_shape(), u_t.get_shape(),x.get_shape(), tf.TensorShape([None, None])])