Rate this Page

torch.accelerator.memory.memory_allocated#

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

Return the current accelerator device memory occupied by tensors in bytes 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.

Return type

int