Tensorflow TypeError: Fetch argument None has invalid type ?

后端 未结 2 1631
不思量自难忘°
不思量自难忘° 2020-12-06 09:50

I\'m building a RNN loosely based on the TensorFlow tutorial.

The relevant parts of my model are as follows:

input_sequence = tf.placeholder(tf.float         


        
2条回答
  •  温柔的废话
    2020-12-06 10:04

    You are re-assigning the train_step variable to the second element of the result of sess.run() (which happens to be None). Hence, on the second iteration, train_step is None, which leads to the error.

    The fix is fortunately simple:

    for i in xrange(1, ITERATIONS):
    
        # ...
    
        # Discard the second element of the result.
        numpy_state, _ = sess.run([final_state, train_step], feed_dict={
            initial_state: numpy_state,
            input_sequence: batch[0],
            output_actual: batch[1]
            })
    

提交回复
热议问题