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

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

Bases: [`Accelerator`](/docs/pytorch/2.6.6/optional-api/api/lightning.pytorch.accelerators.Accelerator.md#lightning.pytorch.accelerators.Accelerator "lightning.pytorch.accelerators.accelerator.Accelerator"), [`XLAAccelerator`](/docs/fabric/stable/api/generated/lightning.fabric.accelerators.XLAAccelerator#lightning.fabric.accelerators.XLAAccelerator "(in lightning v2.7.0.dev)")

Accelerator for XLA devices, normally TPUs.

Warning

Use of this accelerator beyond import and instantiation is experimental.

#### `get_device_stats(device)` {#lightning.pytorch.accelerators.XLAAccelerator.get_device_stats}

Gets stats for the given XLA device.

Parameters:

**device** (`Union`\[[`device`](https://docs.pytorch.org/docs/stable/tensor_attributes.html#torch.device "(in PyTorch v2.15)"), [`str`](https://docs.python.org/3/builtins/stdtypes.html#str "(in Python v3.15)"), [`int`](https://docs.python.org/3/builtins/functions.html#int "(in Python v3.15)")\]) – XLA device for which to get stats

Return type:

[`dict`](https://docs.python.org/3/builtins/stdtypes.html#dict "(in Python v3.15)")\[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str "(in Python v3.15)"), [`Any`](https://docs.python.org/3/library/typing.html#typing.Any "(in Python v3.15)")\]

Returns:

A dictionary mapping the metrics (free memory and peak memory) to their values.

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

The name of the accelerator.

Return type:

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

#### `classmethod register_accelerators(accelerator_registry)` {#lightning.pytorch.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)")

---

**Navigation**

- Parent: [Api](/docs/pytorch/2.6.6/optional-api/api.md)
