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

### `class thunder.core.devices.Device(string_or_devicetype, index=None, /)` {#thunder.core.devices.Device}

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

Bases: [`object`](https://docs.python.org/3/builtins/functions.html#object "(in Python v3.15)")

#### `__init__(string_or_devicetype, index=None, /)` {#thunder.core.devices.Device.__init__}

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

Parameters:

*   **string\_or\_devicetype** ([_str_](https://docs.python.org/3/builtins/stdtypes.html#str "(in Python v3.15)") _|_ [_thunder.core.devices.DeviceType_](/docs/thunder/0.2.6/api-reference/generated/thunder.core.devices.DeviceType.md#thunder.core.devices.DeviceType "thunder.core.devices.DeviceType")) –
    
*   **index** ([_Union_](https://docs.python.org/3/library/typing.html#typing.Union "(in Python v3.15)")_\[__None__,_ [_int_](https://docs.python.org/3/builtins/functions.html#int "(in Python v3.15)")_\]_) –
    

Methods

- [`__init__(string_or_devicetype[, index])`](#thunder.core.devices.Device.__init__)
- `device_str()` — rtype:str

Attributes

- `devicetype`
- `index`
- `type`

---

**Navigation**

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