tensorflow 2.x分布式集群
我一直在尝试使用TF_CONFIG在集群的不同服务器上分发我的模型。 然而,我找到的所有资源都使用tensorflow 1.x方法tensorflow 2.x分布式集群,tensorflow,server,cluster-computing,tensorflow2.0,distributed-computing,Tensorflow,Server,Cluster Computing,Tensorflow2.0,Distributed Computing,我一直在尝试使用TF_CONFIG在集群的不同服务器上分发我的模型。 然而,我找到的所有资源都使用tensorflow 1.x方法 import tensorflow as tf cluster = tf.train.ClusterSpec({"local": ["localhost:2222", "localhost:2223"]}) x = tf.constant(2) with tf.device("/job:local/task:1"): y2 = x - 66 wi
import tensorflow as tf
cluster = tf.train.ClusterSpec({"local": ["localhost:2222", "localhost:2223"]})
x = tf.constant(2)
with tf.device("/job:local/task:1"):
y2 = x - 66
with tf.device("/job:local/task:0"):
y1 = x + 300
y = y1 + y2
with tf.Session("grpc://localhost:2222") as sess:
result = sess.run(y)
print(result)
在tensorflow 2.x中,如果没有tf.Session,我该怎么做