torch.xpu.memory_stats β€” PyTorch 2.7 documentation (original) (raw)

torch.xpu.memory_stats(device=None)[source][source]ΒΆ

Return a dictionary of XPU memory allocator statistics for a given device.

The return value of this function is a dictionary of statistics, each of which is a non-negative integer.

Core statistics:

For these core statistics, values are broken down as follows.

Pool type:

Metric type:

Parameters

device (torch.device or int or str, optional) – selected device. Returns statistics for the current device, given by current_device(), if device is None (default).

Return type

dict[str, Any]