import torch
flag = torch.cuda.is_available()
print(flag)
ngpu= 1
# Decide which device we want to run on
device = torch.device("cuda:0" if (torch.cuda.is_available() and ngpu > 0) else "cpu")
print(device)
print(torch.cuda.get_device_name(0))
print(torch.rand(3,3).cuda())
pytorch:测试GPU是否可用
原创
©著作权归作者所有:来自51CTO博客作者爱啃鸡爪的小米的原创作品,请联系作者获取转载授权,否则将追究法律责任
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
pytorch查看cuda显存
pytorch,CUDA是否可用,查看显卡显存剩余容量
CUDA pytorch