# tf.config.experimental_connect_to_cluster

<br />

|---|---|
| [![](https://www.tensorflow.org/images/tf_logo_32px.png) TensorFlow 2 version](https://www.tensorflow.org/api_docs/python/tf/config/experimental_connect_to_cluster) | [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/python/eager/remote.py#L76-L125) |

Connects to the given cluster.

#### View aliases


**Compat aliases for migration**

See
[Migration guide](https://www.tensorflow.org/guide/migrate) for
more details.

[`tf.compat.v1.config.experimental_connect_to_cluster`](https://www.tensorflow.org/api_docs/python/tf/config/experimental_connect_to_cluster), \`tf.compat.v2.config.experimental_connect_to_cluster\`

<br />

    tf.config.experimental_connect_to_cluster(
        cluster_spec_or_resolver, job_name='localhost', task_index=0, protocol=None
    )

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.

<br />

<br />

<br />

| ## Args ||
|---|---|
| `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/remote_utils.py`. |

<br />