评价此页

torch.accelerator.memory.memory_allocated#

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

返回指定设备索引上,当前 加速器 设备被张量占用的内存(以字节为单位)。

参数

device_index (torch.device, str, int, optional) – 要定位的设备索引。如果未给出,则默认使用 torch.accelerator.current_device_index()。如果提供了 torch.device 或 str,则其类型必须与当前的 accelerator 设备类型匹配。

返回类型

int