import torch print(torch.cuda.is_available()) # 应输出 True print(torch.cuda.device_count()) # 显示检测到的 GPU 数量