Rate this Page

torch.accelerator.memory.get_memory_info#

torch.accelerator.memory.get_memory_info(device_index=None, /)[source]#

Return the current device memory information for a given device index.

Parameters:

device_index (torch.device, str, int, optional) – the index of the device to target. If not given, use torch.accelerator.current_device_index() by default. If a torch.device or str is provided, its type must match the current accelerator device type.

Returns:

a tuple of two integers (free_memory, total_memory) in bytes.

The first value is the free memory on the device (available across all processes and applications), The second value is the device’s total hardware memory capacity.

Return type:

tuple[int, int]