# tf.config.experimental.list_physical_devices

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/python/framework/config.py#L296-L318) |

Return a list of physical devices visible to the runtime.

#### View aliases


**Compat aliases for migration**

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

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

<br />

    tf.config.experimental.list_physical_devices(
        device_type=None
    )

Physical devices are hardware devices locally present on the current machine.
By default all discovered CPU and GPU devices are considered visible. The
`list_physical_devices` allows querying the hardware prior to runtime
initialization.

The following example ensures the machine can see at least 1 GPU.

    physical_devices = tf.config.experimental.list_physical_devices('GPU')
    assert len(physical_devices) > 0, "No GPUs found."

<br />

<br />

<br />

| ## Args ||
|---|---|
| `device_type` | (optional) Device type to filter by such as "CPU" or "GPU" |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| List of PhysicalDevice objects ||

<br />