【GPU】使用 pytorch 检测 CUDA 安装是否成功

使用 pytorch 检测 CUDA 安装是否成功

import torch

import os
os.environ["CUDA_VISIBLE_DEVICES"] = "0"
 
print(torch.cuda.device_count())
print(torch.cuda.is_available())
print(torch.backends.cudnn.is_available())
print(torch.cuda_version)
print(torch.backends.cudnn.version())

你可能感兴趣的:(Taichi,图形学,深度学习,Python实用源码,pytorch,人工智能,python)