Tensor is not an element of this graph

Try first:

import tensorflow as tf
graph = tf.get_default_graph()

Then, when you need to use predict:

with graph.as_default():
     y = model.predict(X)

Leave a Comment