TensorFlow 2 version View source on GitHub

Connects to the given cluster.

Will make devices on the cluster available to use. Note that calling this more than once will work, but will invalidate any tensor handles on the old remote devices.

If the given local job name is not present in the cluster specification, it will be automatically added, using an unused port on the localhost.

cluster_spec_or_resolver A ClusterSpec or ClusterResolver describing the cluster.
job_name The name of the local job.
task_index The local task index.
protocol The communication protocol, such as "grpc". If unspecified, will use the default from python/platform/