---
title: XLAAccelerator
description: 'Accelerator for XLA devices, normally TPUs.'
canonical: >-
  https://lightning.ai/docs/fabric/stable/full-api-reference/api/generated/lightning.fabric.accelerators.XLAAccelerator
---
# XLAAccelerator {#xlaaccelerator}

### `class lightning.fabric.accelerators.XLAAccelerator(*args, **kwargs)` {#lightning.fabric.accelerators.XLAAccelerator}

Bases: [`Accelerator`](/docs/fabric/2.6.6/full-api-reference/api/generated/lightning.fabric.accelerators.Accelerator.md#lightning.fabric.accelerators.Accelerator "lightning.fabric.accelerators.accelerator.Accelerator")

Accelerator for XLA devices, normally TPUs.

Warning

Use of this accelerator beyond import and instantiation is experimental.

#### `static auto_device_count()` {#lightning.fabric.accelerators.XLAAccelerator.auto_device_count}

Get the devices when set to auto.

Return type:

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

#### `static get_parallel_devices(devices)` {#lightning.fabric.accelerators.XLAAccelerator.get_parallel_devices}

Gets parallel devices for the Accelerator.

Return type:

[`list`](https://docs.python.org/3/builtins/stdtypes.html#list "(in Python v3.15)")\[[`device`](https://docs.pytorch.org/docs/stable/tensor_attributes.html#torch.device "(in PyTorch v2.15)")\]

#### `static is_available()` {#lightning.fabric.accelerators.XLAAccelerator.is_available}

Detect if the hardware is available.

Return type:

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

#### `static name()` {#lightning.fabric.accelerators.XLAAccelerator.name}

The name of the accelerator.

Return type:

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

#### `static parse_devices(devices)` {#lightning.fabric.accelerators.XLAAccelerator.parse_devices}

Accelerator device parsing logic.

Return type:

`Union`\[[`int`](https://docs.python.org/3/builtins/functions.html#int "(in Python v3.15)"), [`list`](https://docs.python.org/3/builtins/stdtypes.html#list "(in Python v3.15)")\[[`int`](https://docs.python.org/3/builtins/functions.html#int "(in Python v3.15)")\]\]

#### `classmethod register_accelerators(accelerator_registry)` {#lightning.fabric.accelerators.XLAAccelerator.register_accelerators}

Register the accelerator with the registry.

Return type:

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

#### `setup_device(device)` {#lightning.fabric.accelerators.XLAAccelerator.setup_device}

Create and prepare the device for the current process.

Return type:

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

#### `teardown()` {#lightning.fabric.accelerators.XLAAccelerator.teardown}

Clean up any state created by the accelerator.

Return type:

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

---

**Navigation**

- Parent: [Generated](/docs/fabric/2.6.6/full-api-reference/api/generated.md)
