# tf.experimental.dtensor.device_name

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v2.14.0/tensorflow/dtensor/python/api.py#L131-L144) |

Returns the singleton DTensor device's name.

    tf.experimental.dtensor.device_name() -> str

This function can be used in the following way:

    import tensorflow as tf

    with tf.device(dtensor.device_name()):
      # ...