<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v2.21.0/tensorflow/python/distribute/cluster_resolver/tpu/tpu_cluster_resolver.py#L58-L73) |

Initialize the TPU devices.

#### View aliases


**Compat aliases for migration**

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

[`tf.compat.v1.tpu.experimental.initialize_tpu_system`](https://www.tensorflow.org/api_docs/python/tf/tpu/experimental/initialize_tpu_system)

<br />

    tf.tpu.experimental.initialize_tpu_system(
        cluster_resolver=None
    )

### Used in the notebooks

| Used in the guide | Used in the tutorials |
|---|---|
| - [Migrate from TPU embedding_columns to TPUEmbedding layer](https://www.tensorflow.org/guide/migrate/tpu_embedding) - [Migrate from TPUEstimator to TPUStrategy](https://www.tensorflow.org/guide/migrate/tpu_estimator) - [Use TPUs](https://www.tensorflow.org/guide/tpu) | - [TensorFlow 2 TPUEmbeddingLayer: Quick Start](https://www.tensorflow.org/recommenders/examples/tpu_embedding_layer) - [Training with Orbit](https://www.tensorflow.org/tfmodels/orbit/index) - [Image classification with Model Garden](https://www.tensorflow.org/tfmodels/vision/image_classification) - [Instance Segmentation with Model Garden](https://www.tensorflow.org/tfmodels/vision/instance_segmentation) - [Object detection with Model Garden](https://www.tensorflow.org/tfmodels/vision/object_detection) |

<br />

<br />

<br />

| ## Args ||
|---|---|
| `cluster_resolver` | A tf.distribute.cluster_resolver.TPUClusterResolver, which provides information about the TPU cluster. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| The tf.tpu.Topology object for the topology of the TPU cluster. If called inside tf.function, it returns the serialized topology object instead. ||

<br />

<br />

<br />

<br />

| ## Raises ||
|---|---|
| `RuntimeError` | If running inside a tf.function. |
| `NotFoundError` | If no TPU devices found in eager mode. |

<br />