# tf.contrib.data.prefetch_to_device

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/contrib/data/python/ops/prefetching_ops.py#L24-L41) |

A transformation that prefetches dataset values to the given `device`. (deprecated)

    tf.contrib.data.prefetch_to_device(
        device, buffer_size=None
    )

> [!WARNING]
> **Warning:** THIS FUNCTION IS DEPRECATED. It will be removed in a future version. Instructions for updating: Use [`tf.data.experimental.prefetch_to_device(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/data/experimental/prefetch_to_device).

> [!NOTE]
> **Note:** Although the transformation creates a [`tf.data.Dataset`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/data/Dataset), the transformation must be the final `Dataset` in the input pipeline.

<br />

<br />

<br />

| ## Args ||
|---|---|
| `device` | A string. The name of a device to which elements will be prefetched. |
| `buffer_size` | (Optional.) The number of elements to buffer on `device`. Defaults to an automatically chosen value. |

<br />

<br />

<br />

<br />

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

<br />