Shortcuts

TPUAccelerator

class pytorch_lightning.accelerators.TPUAccelerator(precision_plugin, training_type_plugin)[source]

Bases: pytorch_lightning.accelerators.accelerator.Accelerator

Accelerator for TPU devices.

Parameters
  • precision_plugin (PrecisionPlugin) – the plugin to handle precision-specific parts

  • training_type_plugin (TrainingTypePlugin) – the plugin to handle different training routines

static auto_device_count()[source]

Get the devices when set to auto.

Return type

int

get_device_stats(device)[source]

Gets stats for the given TPU device.

Parameters

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

Return type

Dict[str, Any]

Returns

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

setup(trainer)[source]
Raises

ValueError – If the precision or training type plugin are unsupported.

Return type

None