KeyError : The Tensor Variable , Refer To The Tensor Which Does Not Exists
Using LSTMCell i trained a model to do text generation . I started the tensorflow session and save all the tensorflow varibles using tf.global_variables_initializer() . import te
Solution 1:
For graph.get_tensor_by_name("prediction:0")
to work you should have named it when you created it. This is how you can name it
prediction = tf.nn.softmax(tf.matmul(last,weight)+bias, name="prediction")
If you have already trained the model and can't rename the tensor, you can still get that tensor by its default name as in,
y_pred = graph.get_tensor_by_name("Reshape_1:0")
If Reshape_1
is not the actual name of the tensor, you'll have to look at the names in the graph and figure it out.
You can inspect that with
for op in graph.get_operations():
print(op.name)
Post a Comment for "KeyError : The Tensor Variable , Refer To The Tensor Which Does Not Exists"