torch.xpu.memory_allocated — PyTorch 2.7 documentation (original) (raw)
torch.xpu.memory_allocated(device=None)[source][source]¶
Return the current GPU memory occupied by tensors in bytes for a given device.
Parameters
device (torch.device or int or str, optional) – selected device. Returns statistic for the current device, given by current_device(), if device is None
(default).
Return type
Note
This is likely less than the amount shown in xpu-smi since some unused memory can be held by the caching allocator and some context needs to be created on GPU.
To analyze traffic and optimize your experience, we serve cookies on this site. By clicking or navigating, you agree to allow our usage of cookies. As the current maintainers of this site, Facebook’s Cookies Policy applies. Learn more, including about available controls: Cookies Policy.