TensorFlow SLICE_TYPE_ERROR (Music_RNN_RBM) - PullRequest
0 голосов
/ 03 марта 2019

Нужна помощь с Music_RNN_RBM

Я уже собрал некоторую находчивую помощь, которая помогла мне решить мелкие проблемы с python, tf и т. Д., Но я довольно застрял в этом.

Вот ошибка, которую дает мне питон:

 File "rnn_rbm_generate.py", line 45, in <module>
    main(sys.argv[1])
  File "rnn_rbm_generate.py", line 40, in main
    generated_music = sess.run(generate(300), feed_dict={x: song_primer}) #Prime the network with song primer and generate an original song
  File "/Users/nico/Documents/python.stuff/Music_RNN_RBM-master/rnn_rbm.py", line 92, in generate
    U = Uarr[np.floor(prime_length/midi_manipulation.num_timesteps), :, :]
  File "/usr/local/lib/python3.7/site-packages/tensorflow/python/ops/array_ops.py", line 618, in _slice_helper
    _check_index(s)
  File "/usr/local/lib/python3.7/site-packages/tensorflow/python/ops/array_ops.py", line 516, in _check_index
    raise TypeError(_SLICE_TYPE_ERROR + ", got {!r}".format(idx))
TypeError: Only integers, slices (`:`), ellipsis (`...`), tf.newaxis (`None`) and scalar tf.int32/tf.int64 tensors are valid indices, got 20.0

и вот фрагмент кода, на который он ссылается:

Uarr = tf.scan(rnn_recurrence, x, initializer=u0)
U = Uarr[np.floor(prime_length/midi_manipulation.num_timesteps), :, :]
[_, _, _, _, _, music] = control_flow_ops.While(lambda count, num_iter, *args: count < num_iter,
                                                 generate_recurrence, [tf.constant(1, tf.int32), tf.constant(num), U,
                                                 tf.zeros([1, n_visible], tf.float32), x,
                                                 tf.zeros([1, n_visible],  tf.float32)])
return music
...