当前位置:网站首页>pytorch框架学习(2)使用GPU训练
pytorch框架学习(2)使用GPU训练
2022-08-10 05:29:00 【Time.Xu】
使用GPU进行训练&常见的Tensor&Hub模块
需要将数据和模型传入到CUDA里进行运算。
在代码上:
与传统的不同的是我们需要指定一个设备,这个设备就是设定为cuda:0
需要把模型放置到我们设定的设备中(CUDA中) .to(设备)
需要把数据放置到我呢设定的设备中(CUDA中) .to(设备)
常见的Tensor有哪些形式
形式 | 备注 | 代码&注释 |
---|---|---|
Scalar | 数值 | dim是0,标量 |
Vector | 向量 | dim是1,在深度学习中通常指特征,例如词向量,某一个维度的特征等 |
matrix | 矩阵 | dim是2,一行就是一个向量。可以认为每一行是每一个人,每一列是同一种特征。 矩阵能做乘法能做内积 |
n-dimensal tensor | 高维张量 | Aijk… |
强大的Hub模块
Hub是为了方便开发者调用已有的代码,是一个model zoo
torch.hub.load()
学习一般不用这个
边栏推荐
- ThreadPoolExecutor thread pool principle
- Flutter开发:报错The following assertion was thrown resolving an image codec:Unable to…的解决方法
- `id` bigint(20) unsigned NOT NULL COMMENT 'Database primary key',
- openGauss源码,在window系统用VSCode维护吗?
- 论文精读 —— 2021 CVPR《Progressive Temporal Feature Alignment Network for Video Inpainting》
- 聊聊 API 管理-开源版 到 SaaS 版
- The sword refers to Offer 033. Variation array
- Concurrency tool class - introduction and use of CountDownLatch, CyclicBarrier, Semaphore, Exchanger
- OneFlow源码解析:算子指令在虚拟机中的执行
- flinkcdc 读取pgsql 的时间被放大了 有大佬知道咋回事吗 gmt_create':1
猜你喜欢
【Static proxy】
Read the excerpt notes made by dozens of lightweight target detection papers for literacy
Qiskit 学习笔记1
大咖说·对话生态|当Confluent遇见云:实时流动的数据更有价值
顺序表的删除,插入和查找操作
EasyGBS连接mysql数据库提示“can’t connect to mysql server”,该如何解决?
看了几十篇轻量化目标检测论文扫盲做的摘抄笔记
聊聊 API 管理-开源版 到 SaaS 版
conda创建虚拟环境方法和pqi使用国内镜像源安装第三方库的方法教程
Stacks and Queues | Valid parentheses, delete all adjacent elements in a string, reverse Polish expression evaluation, maximum sliding window, top K high frequency elements | leecode brush questions
随机推荐
实战小技巧19:List转Map List的几种姿势
Linear Algebra (4)
FPGA engineer interview questions collection 11~20
FPGA工程师面试试题集锦1~10
FPGA工程师面试试题集锦21~30
Get started with the OAuth protocol easily with a case
论文精度 —— 2016 CVPR 《Context Encoders: Feature Learning by Inpainting》
基于Qiskit——《量子计算编程实战》读书笔记(五)
我用这一招让团队的开发效率提升了 100%!
Flutter开发:报错The following assertion was thrown resolving an image codec:Unable to…的解决方法
大佬们,mysql cdc(2.2.1跟之前的版本)从savepoint起有时出现这种情况,有没有什
k-近邻实现手写数字识别
Conda creates a virtual environment method and pqi uses a domestic mirror source to install a third-party library method tutorial
SQLSERVER 2008 parses data in Json format
顺序表的删除,插入和查找操作
AVL tree insertion--rotation notes
SQL Server query optimization
aliases node analysis
暑期学前作业
Qiskit 学习笔记2