当前位置:网站首页>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()
学习一般不用这个
边栏推荐
- 【LeetCode】41、 缺失的第一个正数
- AVL树的插入--旋转笔记
- Ask you guys.The FlinkCDC2.2.0 version in the CDC community has a description of the supported sqlserver version, please
- 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
- Pony语言学习(六):Struct, Type Alias, Type Expressions
- Big guys, mysql cdc (2.2.1 and previous versions) sometimes has this situation since savepoint, is there anything wrong?
- 基于Qiskit——《量子计算编程实战》读书笔记(六)
- 基于Qiskit——《量子计算编程实战》读书笔记(二)
- 从GET切换为POST提交数据的方法
- Matlab simulation of multi-factor house price prediction based on BP neural network
猜你喜欢
随机推荐
栈与队列 | 用栈实现队列 | 用队列实现栈 | 基础理论与代码原理
Stacks and Queues | Implementing Queues with Stacks | Implementing Stacks with Queues | Basic Theory and Code Principles
反转链表中的第m至第n个节点---leetcode
Nexus_Warehouse Type
oracle rac 11g安装执行root.sh时报错
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
动手写prometheus的exporter-02-Counter(计数器)
细数国产接口协作平台的六把武器!
Become a language that hackers have to learn. Do you think it's okay after reading it?
scikit-learn机器学习 读书笔记(一)
OneFlow源码解析:算子指令在虚拟机中的执行
一篇文章带你搞懂什么是幂等性问题?如何解决幂等性问题?
flinkcdc 读取pgsql 的时间被放大了 有大佬知道咋回事吗 gmt_create':1
8.STM32F407之HAL库——PWM笔记
Touch chip used in smart touch remote control
每周推荐短视频:探索AI的应用边界
基于Servlet的验证码登陆demo
How to use Apifox's Smart Mock function?
Joomla vulnerability reproduced
基于Qiskit——《量子计算编程实战》读书笔记(五)