Shortcuts

Accelerator

class pytorch_lightning.accelerators.Accelerator[source]

Bases: lightning_fabric.accelerators.accelerator.Accelerator, abc.ABC

The Accelerator base class for Lightning PyTorch.

An Accelerator is meant to deal with one type of hardware.

get_device_stats(device)[source]

Get stats for a given device.

Parameters:

device (Union[device, str, int]) – device for which to get stats

Return type:

Dict[str, Any]

Returns:

Dictionary of device stats

setup(trainer)[source]

Setup plugins for the trainer fit and creates optimizers.

Parameters:

trainer (Trainer) – the trainer instance

Return type:

None

setup_environment(root_device)[source]

Deprecated since version v1.8.0: This hook was deprecated in v1.8.0 and will be removed in v2.0.0. Please use setup_device() instead.

Return type:

None