# tf.raw_ops.DeviceIndex

<br />

Return the index of device the op runs.

#### View aliases


**Compat aliases for migration**

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

[`tf.compat.v1.raw_ops.DeviceIndex`](https://www.tensorflow.org/api_docs/python/tf/raw_ops/DeviceIndex)

<br />

    tf.raw_ops.DeviceIndex(
        device_names, name=None
    )

Given a list of device names, this operation returns the index of the device
this op runs. The length of the list is returned in two cases:
(1) Device does not exist in the given device list.
(2) It is in XLA compilation.

<br />

<br />

<br />

| ## Args ||
|---|---|
| `device_names` | A list of `strings`. |
| `name` | A name for the operation (optional). |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| A `Tensor` of type `int32`. ||

<br />