---
title: thunder.core.devices.to_device
canonical: >-
  https://lightning.ai/docs/thunder/stable/api-reference/generated/thunder.core.devices.to_device
---
# thunder.core.devices.to_device {#thunder-core-devices-to-device}

### `thunder.core.devices.to_device(x, /)` {#thunder.core.devices.to_device}

[\[source\]](https://github.com/Lightning-AI/lightning-thunder/blob/0.2.6/thunder/core/devices.py#L180-L185)

Return type:

[`Optional`](https://docs.python.org/3/library/typing.html#typing.Optional "(in Python v3.15)")\[[`Device`](/docs/thunder/0.2.6/api-reference/generated/thunder.core.devices.Device.md#thunder.core.devices.Device "thunder.core.devices.Device")\]

Parameters:

**x** (_None_ _|_ [_str_](https://docs.python.org/3/builtins/stdtypes.html#str "(in Python v3.15)") _|_ [_torch.device_](https://docs.pytorch.org/docs/stable/tensor_attributes.html#torch.device "(in PyTorch v2.15)") _|_ [_thunder.core.devices.Device_](/docs/thunder/0.2.6/api-reference/generated/thunder.core.devices.Device.md#thunder.core.devices.Device "thunder.core.devices.Device")) –

---

**Navigation**

- Parent: [Generated](/docs/thunder/0.2.6/api-reference/generated.md)
