torch.cuda.mem_get_info
- torch.cuda.mem_get_info(device=None)[源代码]
-
使用 cudaMemGetInfo 获取并返回给定设备的全局空闲和总 GPU 内存。
- 参数
-
device (torch.device 或 int 或 str, 可选) – 选定的设备。如果
device
为None
(默认值)或未指定设备索引,则返回当前设备的统计信息,该信息由current_device()
提供。 - 返回类型
-
元组[int, int]
注意
关于GPU内存管理的更多信息,请参见内存管理。