当前位置:网站首页>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())
边栏推荐
- R language ggplot2 visualization: use the ggdotplot function of ggpubr package to visualize dot plot, set the palette parameter, and set the colors of data points and box graphs of dot plots at differ
- Analysis of frequent chain breaks in applications using Druid connection pools
- 人体骨骼点检测:自顶向下(部分理论)
- Precautions for binding shortcut keys of QPushButton
- Describe the process of key exchange
- AIRIOT物联网平台赋能集装箱行业构建【焊接工位信息监控系统】
- 上海部分招工市场对新冠阳性康复者拒绝招录
- Use cpolar to build a business website (1)
- AutoCAD - what is the default lineweight for centerline drawing and CAD? Can I modify it?
- 抽象类与抽象方法
猜你喜欢
Understanding disentangling in β- VAE paper reading notes
If you have any problems, you can contact me. A rookie ~
一种用于夜间和无袖测量血压手臂可穿戴设备【翻译】
如何提高网站权重
Yutai micro rushes to the scientific innovation board: Huawei and Xiaomi fund are shareholders to raise 1.3 billion
同宇新材冲刺深交所:年营收9.47亿 张驰与苏世国为实控人
C#/VB. Net to add text / image watermarks to PDF documents
C#/VB.NET 给PDF文档添加文本/图像水印
None of the strongest kings in the monitoring industry!
Nuc11 cheetah Canyon setting U disk startup
随机推荐
上海部分招工市场对新冠阳性康复者拒绝招录
How to improve website weight
Tongyu Xincai rushes to Shenzhen Stock Exchange: the annual revenue is 947million Zhang Chi and Su Shiguo are the actual controllers
First, look at K, an ugly number
[paper notes] transunet: transformers make strongencoders for medical image segmentation
R语言ggplot2可视化:使用ggpubr包的ggviolin函数可视化小提琴图
R language ggplot2 visualization: use ggviolin function of ggpubr package to visualize violin diagram
Use map function and split function to type multiple elements in one line
helm部署etcd集群
Estimate blood pressure according to PPG using spectral spectrum time depth neural network [turn]
R语言dplyr包进行数据分组聚合统计变换(Aggregating transforms)、计算dataframe数据的分组均值(mean)
Method of accessing mobile phone storage location permission under non root condition
Crawling data encounters single point login problem
SQL injection Foundation
多线程基础:线程基本概念与线程的创建
Jdbc driver, c3p0, druid and jdbctemplate dependent jar packages
[Sun Yat sen University] information sharing of postgraduate entrance examination and re examination
Helm deploy etcd cluster
The nearest library of Qinglong panel
朗坤智慧冲刺科创板:年营收4亿 拟募资7亿