当前位置:网站首页>【PYTORCH】RuntimeError: torch. cuda. FloatTensor is not enabled.
【PYTORCH】RuntimeError: torch. cuda. FloatTensor is not enabled.
2022-06-13 07:46:00 【neu_ eddata_ yjzhang】
The reason for this error is that you are installing cpu Version of pytorch Up operation GPU Version of pytorch Code for .
resolvent :
Place the error in ".cuda()" Switch to ".cpu()"
Some of the downloaded code needs GPU Calculation , And computers don't GPU, At this point, you can add the following code at the beginning of the code to obtain whether the current computer has GPU
# gpu or not
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
And then in the code use .to(device) Replace .cuda() perhaps .cpu() Can be found in GPU On your computer GPU Computational acceleration , In the absence of GPU On your computer CPU Calculation , But it's slower
边栏推荐
- [tools for quickly creating MySQL stand-alone and cluster test environments] dbdeployer
- Login registration
- Learning notes of balanced binary tree -- one two pandas
- Precautions for passing parameters with byte array
- A troubleshooting process for database timeout caused by SQL misguided
- EF core execute SQL statement
- 19 | 建立数据通路(下):指令+运算=CPU
- Index push down (ICP) for mysql5.6
- [MySQL change master error] slave is not configured or failed to initialize properly
- IIS中的网站访问excel
猜你喜欢
Distributed transaction learning (I) preliminary understanding
How idea breaks point debugging
Redis learning journey - persistence
25 | adventure and prediction (IV): it's raining today. Will it rain tomorrow?
Data desensitization tool advance tool Datamask
2022 simulated examination question bank and online simulated examination of hoisting machinery command examination questions
18 | 建立数据通路(中):指令+运算=CPU
MySQL Gtid_ Executed and gtid_ Purged modification time
24 | adventure and prediction (III): thread pool in CPU
IDS persistence ---rdb
随机推荐
20 | pipeline oriented instruction design (Part 1): Modern CPU with multi-purpose
MySQL summary
MySQL Gtid_ Executed and gtid_ Purged modification time
23 | 冒险和预测(二):流水线里的接力赛
First graphical interface
Go interface implementation principle [advanced level]: type_ interface struct
Redis underlying data structure - underlying principle of hash table
2021-10-08
leetcode 咒语和药水的成功对数
25 domestic and foreign literature databases
力扣(LeetCode)163. 缺失的区间(2022.06.12)
Redis Cluster - the bottom principle of building clusters
21 | 面向流水线的指令设计(下):奔腾4是怎么失败的?
OpenHarmony笔记-----------(一)
Database outline
Nodejs file module FS
[MySQL] methods for troubleshooting lock related problems
A. Vacations (dp 贪心
How idea breaks point debugging
平衡二叉树学习笔记------一二熊猫