评价此页

torch.cuda.memory.mem_get_info#

torch.cuda.memory.mem_get_info(device=None)[source]#

返回指定设备的全局空闲和总 GPU 内存,使用 cudaMemGetInfo。

参数

device (torch.deviceintstr, 可选) – 选择的设备。如果 deviceNone(默认)或未指定设备索引,则返回当前设备(由 current_device() 定义)的统计信息。

返回类型

tuple[int, int]

注意

有关 GPU 内存管理的更多详细信息,请参阅 内存管理