# tf.data.experimental.copy_to_device

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v2.13.1/tensorflow/python/data/experimental/ops/prefetching_ops.py#L65-L82) |

A transformation that copies dataset elements to the given `target_device`.

#### View aliases


**Compat aliases for migration**

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

[`tf.compat.v1.data.experimental.copy_to_device`](https://www.tensorflow.org/api_docs/python/tf/data/experimental/copy_to_device)

<br />

    tf.data.experimental.copy_to_device(
        target_device, source_device='/cpu:0'
    )

<br />

<br />

<br />

| ## Args ||
|---|---|
| `target_device` | The name of a device to which elements will be copied. |
| `source_device` | The original device on which `input_dataset` will be placed. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| A `Dataset` transformation function, which can be passed to [`tf.data.Dataset.apply`](https://www.tensorflow.org/versions/r2.13/api_docs/python/tf/data/Dataset#apply). ||

<br />