当前位置:网站首页>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())
边栏推荐
- ACTF 2022圆满落幕,0ops战队二连冠!!
- C#/VB. Net to add text / image watermarks to PDF documents
- 二叉搜索树
- Cobra quick start - designed for command line programs
- Airiot IOT platform enables the container industry to build [welding station information monitoring system]
- AcWing 3537.树查找 完全二叉树
- Interpreting cloud native technology
- 五金机电行业供应商智慧管理平台解决方案:优化供应链管理,带动企业业绩增长
- helm部署etcd集群
- [matlab] Simulink the input and output variables of the same module cannot have the same name
猜你喜欢

pytorch常见损失函数

pychrm社区版调用matplotlib.pyplot.imshow()函数图像不弹出的解决方法

Pytorch common loss function
![Optical blood pressure estimation based on PPG and FFT neural network [translation]](/img/88/2345dac73248a5f0f9fa3142ca0397.png)
Optical blood pressure estimation based on PPG and FFT neural network [translation]

Yutai micro rushes to the scientific innovation board: Huawei and Xiaomi fund are shareholders to raise 1.3 billion

Hongke shares | plate by plate ar application in Beijing Winter Olympics

爬虫玩得好,牢饭吃到饱?这3条底线千万不能碰!

ROS custom message publishing subscription example

Understanding disentangling in β- VAE paper reading notes

AIRIOT物联网平台赋能集装箱行业构建【焊接工位信息监控系统】
随机推荐
【论文笔记】TransUNet: Transformers Make StrongEncoders for Medical Image Segmentation
Xingnuochi technology's IPO was terminated: it was planned to raise 350million yuan, with an annual revenue of 367million yuan
About NPM install error 1
Example of implementing web server with stm32+enc28j60+uip protocol stack
Understanding disentangling in β- VAE paper reading notes
Crawling data encounters single point login problem
R language ggplot2 visualization: use ggviolin function of ggpubr package to visualize violin diagram
R language ggplot2 visual time series histogram: visual time series histogram through two-color gradient color matching color theme
AcWing 3537. Tree lookup complete binary tree
Test 1234
AvL树的实现
SQL injection - access injection, access offset injection
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
深度循环网络长期血压预测【翻译】
R语言ggplot2可视化:使用ggpubr包的ggstripchart函数可视化分组点状条带图(dot strip plot)、设置add参数为不同水平点状条带图添加箱图
Analysis of frequent chain breaks in applications using Druid connection pools
Noninvasive and cuff free blood pressure measurement for telemedicine [translation]
How are you in the first half of the year occupied by the epidemic| Mid 2022 summary
倒计时2天|腾讯云消息队列数据接入平台(Data Import Platform)直播预告
Estimate blood pressure according to PPG using spectral spectrum time depth neural network [turn]