g1 = tf.Graph()
sess1 = tf.Session(graph=g1)
tf.Session 的注释当存在两个graph时,可以对其中一个采用全局默认的graph和Session;而另外一个则需要重新创建graph和Session,
If nograph
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 withtf.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
【多模型运行冲突问题】在创建模型和运行模型时,在前面包含:
with g2.as_default():
with sess2.as_default():
# 加载或构造模型
# 模型预测
https://blog.csdn.net/googler_offer/article/details/91416521
推荐阅读
- 人工智能|hugginface-introduction 案例介绍
- 深度学习|论文阅读(《Deep Interest Evolution Network for Click-Through Rate Prediction》)
- nlp|Keras(十一)梯度带(GradientTape)的基本使用方法,与tf.keras结合使用
- NER|[论文阅读笔记01]Neural Architectures for Nested NER through Linearization
- 深度学习|2019年CS224N课程笔记-Lecture 17:Multitask Learning
- 深度学习|[深度学习] 一篇文章理解 word2vec
- 论文|预训练模型综述2020年三月《Pre-trained Models for Natural Language Processing: A Survey》
- NLP|NLP预训练模型综述
- NLP之文本表示——二值文本表示
- 隐马尔科夫HMM应用于中文分词