torch.cuda.get_per_process_memory_fraction¶ torch.cuda.get_per_process_memory_fraction(device=None)[source][source]¶ 獲取程序的記憶體使用比例。 引數 device (torch.device 或 int, 可選) – 選擇的裝置。如果為 None,則使用預設 CUDA 裝置。 返回 記憶體分數,範圍為 0~1。允許的記憶體等於 total_memory * fraction。 返回型別 float