<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/keras-team/keras/tree/v3.15.1/keras/src/distribution/distribution_lib.py#L21-L42) |

Return all the available devices based on the device type.

    tf.keras.distribution.list_devices(
        device_type=None
    )

> [!NOTE]
> **Note:** in a distributed setting, global devices are returned.

When `device_type` is not provided, devices of the default type are
returned. This function nevers return a mix of device types, for instance
GPUs and CPUs.

<br />

<br />

<br />

| ## Args ||
|---|---|
| `device_type` | string, one of `"cpu"`, `"gpu"` or `"tpu"`. Defaults to `"gpu"` or `"tpu"` if available when `device_type` is not provided. Otherwise returns the `"cpu"` devices. |

<br />

<br />

<br />

<br />

| ## Return ||
|---|---|
| List of string, the devices that are available for distributed computation. Each device is formatted as "device_type:id", for instance "gpu:1" or "cpu:0". ||

<br />