評價此頁

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