Rate this Page

torch.xpu.memory.max_memory_allocated#

torch.xpu.memory.max_memory_allocated(device=None)[source]#

Return the maximum GPU memory occupied by tensors in bytes for a given device.

By default, this returns the peak allocated memory since the beginning ofthis program.reset_peak_memory_stats() can be used toreset the starting point in tracking this metric. For example, these twofunctions can measure the peak allocated memory usage of each iteration in atraining loop.

Parameters

device (torch.device orint orstr,optional) – selected device. Returnsstatistic for the current device, given bycurrent_device(),ifdevice isNone (default).

Return type

int