当前位置:网站首页>Tensorflow and torch code verify whether CUDA is successfully installed
Tensorflow and torch code verify whether CUDA is successfully installed
2022-07-06 19:05:00 【The mountain of ignorance, the valley of despair, the slope of 】
tensorflow Code validation cuda Is the installation successful
tensorflow test cuda Is the installation successful , Test code environment
tensorflow
import tensorflow as tf
tf.test.is_gpu_available()
perhaps
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())
边栏推荐
- About static type, dynamic type, ID, instancetype
- Certains marchés de l'emploi de Shanghai refusent d'embaucher des personnes qui se rétablissent positives à Xinguan
- Camel case with Hungarian notation
- This article discusses the memory layout of objects in the JVM, as well as the principle and application of memory alignment and compression pointer
- About NPM install error 1
- Describe the process of key exchange
- Xingnuochi technology's IPO was terminated: it was planned to raise 350million yuan, with an annual revenue of 367million yuan
- 一种用于夜间和无袖测量血压手臂可穿戴设备【翻译】
- Analysis of frequent chain breaks in applications using Druid connection pools
- Online notes
猜你喜欢
深度循环网络长期血压预测【翻译】
Jushan database was among the first batch of financial information innovation solutions!
A wearable arm device for night and sleeveless blood pressure measurement [translation]
Optical blood pressure estimation based on PPG and FFT neural network [translation]
Interview assault 63: how to remove duplication in MySQL?
On AAE
涂鸦智能在香港双重主板上市:市值112亿港元 年营收3亿美元
The role of applet in industrial Internet
[paper notes] transunet: transformers make strongencoders for medical image segmentation
When visual studio code starts, it prompts "the code installation seems to be corrupt. Please reinstall." Solution to displaying "unsupported" information in the title bar
随机推荐
If you have any problems, you can contact me. A rookie ~
Binary search tree
On AAE
安装及管理程序
R language ggplot2 visual time series histogram: visual time series histogram through two-color gradient color matching color theme
There is a sound prompt when inserting a USB flash disk under win10 system, but the drive letter is not displayed
node の SQLite
五金机电行业智能供应链管理系统解决方案:数智化供应链为传统产业“造新血”
AcWing 3537. Tree lookup complete binary tree
测试行业的小伙伴,有问题可以找我哈。菜鸟一枚~
Pychrm Community Edition calls matplotlib pyplot. Solution of imshow() function image not popping up
Abstract classes and abstract methods
Unlock 2 live broadcast themes in advance! Today, I will teach you how to complete software package integration Issues 29-30
线代笔记....
A wearable arm device for night and sleeveless blood pressure measurement [translation]
Use map function and split function to type multiple elements in one line
R语言ggplot2可视化:使用ggpubr包的ggviolin函数可视化小提琴图
Collection of penetration test information -- use with nmap and other tools
五金机电行业供应商智慧管理平台解决方案:优化供应链管理,带动企业业绩增长
关于静态类型、动态类型、id、instancetype