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
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]
})
Another common reason to get this error is if you include the summary fetch operation but have not written any summaries.
Example:
# tf.summary.scalar("loss", loss) # <- uncomment this line and it will work fine
summary_op = tf.summary.merge_all()
sess = tf.Session()
# ...
summary = sess.run([summary_op, ...], feed_dict={...}) # TypeError, summary_op is "None"!
What's extra confusing is that summary_op
is not itself None, that's just the error that bubbles up from inside the session's run method.