当前位置:网站首页>tensorflow和torch代码验证cuda是否安装成功
tensorflow和torch代码验证cuda是否安装成功
2022-07-06 11:10:00 【愚昧之山绝望之谷开悟之坡】
tensorflow代码验证cuda是否安装成功
tensorflow 测试 cuda 是否安装成功,测试代码环境
tensorflow
import tensorflow as tf
tf.test.is_gpu_available()
或者
sess = tf.Session(config=tf.ConfigProto(log_device_placement=True))
torch
import torch
flag = torch.cuda.is_available()
print(flag)
gpunumber = 1
Decide which device we want to run on
device = torch.device("cuda:0" if (torch.cuda.is_available() and gpunumber > 0) else "cpu")
print(device)
print(torch.cuda.get_device_name(0))
print(torch.rand(3,3).cuda())
边栏推荐
- helm部署etcd集群
- From 2022 to 2024, the list of cifar azrieli global scholars was announced, and 18 young scholars joined 6 research projects
- Summary of performance knowledge points
- If you have any problems, you can contact me. A rookie ~
- RedisSystemException:WRONGTYPE Operation against a key holding the wrong kind of value
- 44 colleges and universities were selected! Publicity of distributed intelligent computing project list
- Huawei 0 foundation - image sorting
- Penetration test information collection - WAF identification
- The nearest library of Qinglong panel
- AutoCAD - what is the default lineweight for centerline drawing and CAD? Can I modify it?
猜你喜欢
如何提高网站权重
Pychrm Community Edition calls matplotlib pyplot. Solution of imshow() function image not popping up
Human bone point detection: top-down (part of the theory)
[matlab] Simulink the input and output variables of the same module cannot have the same name
None of the strongest kings in the monitoring industry!
监控界的最强王者,没有之一!
Unlock 2 live broadcast themes in advance! Today, I will teach you how to complete software package integration Issues 29-30
一种用于夜间和无袖测量血压手臂可穿戴设备【翻译】
线代笔记....
[depth first search] Ji suanke: find numbers
随机推荐
R language uses rchisq function to generate random numbers that conform to Chi square distribution, and uses plot function to visualize random numbers that conform to Chi square distribution
Interpreting cloud native technology
Penetration test information collection - App information
人体骨骼点检测:自顶向下(部分理论)
First, look at K, an ugly number
[paper notes] transunet: transformers make strongencoders for medical image segmentation
Video based full link Intelligent Cloud? This article explains in detail what Alibaba cloud video cloud "intelligent media production" is
How are you in the first half of the year occupied by the epidemic| Mid 2022 summary
AvL树的实现
AcWing 3537.树查找 完全二叉树
Cobra quick start - designed for command line programs
AUTOCAD——中心线绘制、CAD默认线宽是多少?可以修改吗?
R语言使用order函数对dataframe数据进行排序、基于单个字段(变量)进行降序排序(DESCENDING)
Lucun smart sprint technology innovation board: annual revenue of 400million, proposed to raise 700million
R语言ggplot2可视化时间序列柱形图:通过双色渐变配色颜色主题可视化时间序列柱形图
None of the strongest kings in the monitoring industry!
Summary of performance knowledge points
关于npm install 报错问题 error 1
Wx applet learning notes day01
R语言使用dt函数生成t分布密度函数数据、使用plot函数可视化t分布密度函数数据(t Distribution)