# tf.experimental.dtensor.create_distributed_mesh

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v2.13.1/tensorflow/dtensor/python/mesh_util.py#L130-L226) |

Creates a distributed mesh.

    tf.experimental.dtensor.create_distributed_mesh(
        mesh_dims: List[Tuple[str, int]],
        mesh_name: str = '',
        local_devices: Optional[List[str]] = None,
        device_type: Optional[str] = None,
        use_xla_spmd: bool = layout.USE_XLA_SPMD
    ) -> https://www.tensorflow.org/versions/r2.13/api_docs/python/tf/experimental/dtensor/Mesh

This is similar to `create_mesh`, but with a different set of arguments to
create a mesh that spans evenly across a multi-client DTensor cluster.

For CPU and GPU meshes, users can choose to use fewer local devices than what
is available `local_devices`.

For TPU, only meshes that uses all TPU cores is supported by the DTensor
runtime.

<br />

<br />

<br />

| ## Args ||
|---|---|
| `mesh_dims` | A list of (dim_name, dim_size) tuples. |
| `mesh_name` | Name of the created mesh. Defaults to ''. |
| `local_devices` | String representations of devices to use. This is the device part of tf.DeviceSpec, e.g. 'CPU:0'. Defaults to all available local logical devices. |
| `device_type` | Type of device to build the mesh for. Defaults to 'CPU'. Supported values are 'CPU', 'GPU', 'TPU'.6 |
| `use_xla_spmd` | Boolean when True, will use XLA SPMD instead of DTensor SPMD. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| A mesh that spans evenly across all DTensor clients in the cluster. ||

<br />