TF2.0中的会话和并行性是如何工作的?

2024-06-17 14:56:36 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图在同一个过程中并行运行两个张量流模型。在

在Tensorflow 1.x中,我们可以做例如Keras Tensorflow - Exception while predicting from multiple threads

graph = tf.Graph()
with graph.as_default():
    session = tf.Session()
    with session.as_default():
        # Create and use the model ...

在Tensorflow 2.0中,会话已被删除。在

当我试图在同一个进程中并行运行两个模型时,Tensorflow崩溃了。有没有办法解决这个问题是tf2.0?在

错误消息:

^{pr2}$

Tags: from模型default过程sessiontftensorflowas