先官网拉取https://download.pytorch.org/whl/torch_stable.html 找到 torch-2.11.0cu128-cp313-cp313-win_amd64.whl再pip install torch2.11.0 torchvision torchaudio --index-url https://download.pytorch.org/whl/cu128测试GPU能力# test/GPU验证.pyimporttorchprint( GPU 信息检测 )print(fGPU 可用{torch.cuda.is_available()})iftorch.cuda.is_available():# 获取显卡数量gpu_counttorch.cuda.device_count()print(f显卡数量{gpu_count})# 遍历每块显卡的详细信息foriinrange(gpu_count):print(f\n--- 显卡{i}---)print(f名称{torch.cuda.get_device_name(i)})print(f计算能力{torch.cuda.get_device_capability(i)})# 获取显存信息单位GBtotal_memorytorch.cuda.get_device_properties(i).total_memory/(1024**3)print(f总显存{total_memory:.2f}GB)# 当前显存使用情况allocatedtorch.cuda.memory_allocated(i)/(1024**3)reservedtorch.cuda.memory_reserved(i)/(1024**3)print(f已分配显存{allocated:.2f}GB)print(f已预留显存{reserved:.2f}GB)# CUDA 版本print(fCUDA 版本{torch.version.cuda})print(fcuDNN 版本{torch.backends.cudnn.version()})else:print(未检测到可用的 GPU将使用 CPU)