当前位置:网站首页>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())
边栏推荐
- How to improve website weight
- AUTOCAD——中心线绘制、CAD默认线宽是多少?可以修改吗?
- helm部署etcd集群
- AutoCAD - what is the default lineweight for centerline drawing and CAD? Can I modify it?
- Breadth first traversal of graph
- 2022.2.12
- Camel case with Hungarian notation
- Penetration test information collection - basic enterprise information
- The role of applet in industrial Internet
- 【论文笔记】TransUNet: Transformers Make StrongEncoders for Medical Image Segmentation
猜你喜欢
Penetration test information collection - WAF identification
能源行业的数字化“新”运维
MRO工业品企业采购系统:如何精细化采购协同管理?想要升级的工业品企业必看!
Multithreading Basics: basic concepts of threads and creation of threads
The role of applet in industrial Internet
This article discusses the memory layout of objects in the JVM, as well as the principle and application of memory alignment and compression pointer
[Matlab] Simulink 同一模块的输入输出的变量不能同名
助力安全人才专业素养提升 | 个人能力认证考核第一阶段圆满结束!
关于npm install 报错问题 error 1
【论文笔记】TransUNet: Transformers Make StrongEncoders for Medical Image Segmentation
随机推荐
Tongyu Xincai rushes to Shenzhen Stock Exchange: the annual revenue is 947million Zhang Chi and Su Shiguo are the actual controllers
Wx applet learning notes day01
This article discusses the memory layout of objects in the JVM, as well as the principle and application of memory alignment and compression pointer
ROS自定义消息发布订阅示例
pytorch常见损失函数
AvL树的实现
Penetration test information collection - site architecture and construction
手写一个的在线聊天系统(原理篇1)
Human bone point detection: top-down (part of the theory)
五金机电行业供应商智慧管理平台解决方案:优化供应链管理,带动企业业绩增长
测试行业的小伙伴,有问题可以找我哈。菜鸟一枚~
Summary of performance knowledge points
R language ggplot2 visualization: use the ggstripchart function of ggpubr package to visualize the grouped dot strip plot, and set the add parameter to add box plots for different levels of dot strip
如何提高网站权重
Jdbc driver, c3p0, druid and jdbctemplate dependent jar packages
包装行业商业供应链管理平台解决方案:布局智慧供应体系,数字化整合包装行业供应链
Word如何显示修改痕迹
裕太微冲刺科创板:拟募资13亿 华为与小米基金是股东
C#/VB. Net to add text / image watermarks to PDF documents
Pychrm Community Edition calls matplotlib pyplot. Solution of imshow() function image not popping up