TypeError: Cannot interpret feed_dict key as Tensor: Tensor Tensor("input_pro:0", shape=(100, 20, 704, 1), dtype=float32) is not an element of this graph.
原代码:
graph=tf.Graph()
with graph.as_default():input_pro=tf.placeholder(tf.float32, [100, 20, 704, 1], name='input_pro')
input_lnc=tf.placeholder(tf.float32, [100, 4, 3395, 1], name='input_lnc')
true_labels=tf.placeholder(tf.float32, [100, 2], name='true_labels')
is_train=tf.placeholder(dtype=bool, shape=[],name='is_train')
learning_rate=tf.placeholder(tf.float32, shape=[], name='learning_rate')
keep_prob=tf.placeholder(tf.float32, name='keep_prob')
修改代码:
graph = tf.get_default_graph()
with graph.as_default():
input_pro=tf.placeholder(tf.float32, [100, 20, 704, 1], name='input_pro')
input_lnc=tf.placeholder(tf.float32, [100, 4, 3395, 1], name='input_lnc')
true_labels=tf.placeholder(tf.float32, [100, 2], name='true_labels')
is_train=tf.placeholder(dtype=bool, shape=[],name='is_train')
learning_rate=tf.placeholder(tf.float32, shape=[], name='learning_rate')
keep_prob=tf.placeholder(tf.float32, name='keep_prob')
修改之后,这个错误就消失了,造成该错误的原因目前还不清楚。