多模型运行冲突问题

g1 = tf.Graph()
sess1 = tf.Session(graph=g1)

tf.Session 的注释
If no graph argument is specified when constructing the session,
the default graph will be launched in the session. If you are
using more than one graph (created with tf.Graph() in the same
process, you will have to use different sessions for each graph,
but each graph can be used in multiple sessions. In this case, it
is often clearer to pass the graph to be launched explicitly to
the session constructor

当存在两个graph时,可以对其中一个采用全局默认的graph和Session;而另外一个则需要重新创建graph和Session,

在创建模型和运行模型时,在前面包含:

   with g2.as_default():
        with sess2.as_default():
        	# 加载或构造模型
        	# 模型预测

https://blog.csdn.net/googler_offer/article/details/91416521

你可能感兴趣的:(nlp)