how to use tensorflow graphs in multithread？valueerror：tensor a must be from the same graph as tensor b！
TensorFlow stores all operations on an operational graph. This graph defines what functions output to where, and it links it all together so that it can follow the steps you have set up in the graph to produce your final output. If you try to input a Tensor or operation on one graph into a Tensor or operation on another graph it will fail. Everything must be on the same execution graph.

Try to use 

tf.reset_default_graph() 


to reset the tf graph once it executes.

For keras use K.clear_session().

For more details about the keras and tensorflow interface view Keras documentation blog.https://blog.keras.io/keras-as-a-simplified-interface-to-tensorflow-tutorial.html this helps you a lot.