当前位置:网站首页>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())
边栏推荐
- Master Xuan joined hands with sunflower to remotely control enabling cloud rendering and GPU computing services
- Cobra quick start - designed for command line programs
- AcWing 3537.树查找 完全二叉树
- Wx applet learning notes day01
- Analysis of frequent chain breaks in applications using Druid connection pools
- AvL树的实现
- SQL injection Foundation
- Penetration test information collection - site architecture and construction
- RedisSystemException:WRONGTYPE Operation against a key holding the wrong kind of value
- Airiot IOT platform enables the container industry to build [welding station information monitoring system]
猜你喜欢
Hongke shares | plate by plate ar application in Beijing Winter Olympics
[Sun Yat sen University] information sharing of postgraduate entrance examination and re examination
Xingnuochi technology's IPO was terminated: it was planned to raise 350million yuan, with an annual revenue of 367million yuan
Yutai micro rushes to the scientific innovation board: Huawei and Xiaomi fund are shareholders to raise 1.3 billion
Binary search tree
Use cpolar to build a business website (1)
朗坤智慧冲刺科创板:年营收4亿 拟募资7亿
[depth first search] Ji suanke: find numbers
Lucun smart sprint technology innovation board: annual revenue of 400million, proposed to raise 700million
Pychrm Community Edition calls matplotlib pyplot. Solution of imshow() function image not popping up
随机推荐
巨杉数据库首批入选金融信创解决方案!
[depth first search] Ji suanke: find numbers
线代笔记....
Wx applet learning notes day01
Abstract classes and abstract methods
能源行业的数字化“新”运维
C#/VB. Net to add text / image watermarks to PDF documents
Collection of penetration test information -- use with nmap and other tools
Xingnuochi technology's IPO was terminated: it was planned to raise 350million yuan, with an annual revenue of 367million yuan
Stm32+esp8266+mqtt protocol connects onenet IOT platform
安装及管理程序
用于远程医疗的无创、无袖带血压测量【翻译】
Installation and management procedures
星诺奇科技IPO被终止:曾拟募资3.5亿元 年营收3.67亿
10、 Process management
test about BinaryTree
关于npm install 报错问题 error 1
Interpreting cloud native technology
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
About static type, dynamic type, ID, instancetype