当前位置:网站首页>也算是学习中的小总结
也算是学习中的小总结
2022-07-06 04:32:00 【成娃子】
#以下代码都是在jupyter notebook中运行的
import torch
c=torch.arange(20).reshape(2,5,2)
c,c.sum(axis=0) #(2,5,2)第一个2消失,两个(5,2)相加
#运行结果
(tensor([[[ 0, 1],
[ 2, 3],
[ 4, 5],
[ 6, 7],
[ 8, 9]],
[[10, 11],
[12, 13],
[14, 15],
[16, 17],
[18, 19]]]),
tensor([[10, 12],
[14, 16],
[18, 20],
[22, 24],
[26, 28]]))
c=torch.arange(20).reshape(2,5,2)
c,c.sum(axis=1) #(2,5,2)第二个5消失,两个(5,2)变成(1,2)再相加
#运行结果
(tensor([[[ 0, 1],
[ 2, 3],
[ 4, 5],
[ 6, 7],
[ 8, 9]],
[[10, 11],
[12, 13],
[14, 15],
[16, 17],
[18, 19]]]),
tensor([[20, 25],
[70, 75]]))
c=torch.arange(20).reshape(2,5,2)
c,c.sum(axis=2) #(2,5,2)第三个2消失,变成(2,5)
#运行结果
(tensor([[[ 0, 1],
[ 2, 3],
[ 4, 5],
[ 6, 7],
[ 8, 9]],
[[10, 11],
[12, 13],
[14, 15],
[16, 17],
[18, 19]]]),
tensor([[ 1, 5, 9, 13, 17],
[21, 25, 29, 33, 37]]))
c=torch.arange(20).reshape(2,5,2)
c,c.sum(axis=1,keepdims=True).shape
#运行截图
(tensor([[[ 0, 1],
[ 2, 3],
[ 4, 5],
[ 6, 7],
[ 8, 9]],
[[10, 11],
[12, 13],
[14, 15],
[16, 17],
[18, 19]]]),
torch.Size([2, 1, 2]))
线性回归模型的步骤
1.生成数据集。
2.读取数据集。
3.初始化模型参数。
4.定义模型
5.损失函数
6.优化算法
7.进行训练
边栏推荐
- Explain in simple terms node template parsing error escape is not a function
- [network] channel attention network and spatial attention network
- 2/12 didn't learn anything
- 2328. 网格图中递增路径的数目(记忆化搜索)
- When debugging after pycharm remote server is connected, trying to add breakpoint to file that does not exist: /data appears_ sda/d:/segmentation
- Recommendation system (IX) PNN model (product based neural networks)
- 图应用详解
- 10個 Istio 流量管理 最常用的例子,你知道幾個?
- word封面下划线
- Sorting out the latest Android interview points in 2022 to help you easily win the offer - attached is the summary of Android intermediate and advanced interview questions in 2022
猜你喜欢
How do programmers teach their bosses to do things in one sentence? "I'm off duty first. You have to work harder."
lora网关以太网传输
One question per day (Mathematics)
Case of Jiecode empowerment: professional training, technical support, and multiple measures to promote graduates to build smart campus completion system
捷码赋能案例:专业培训、技术支撑,多措并举推动毕业生搭建智慧校园毕设系统
Fedora/REHL 安装 semanage
颠覆你的认知?get和post请求的本质
View workflow
图应用详解
Query the number and size of records in each table in MySQL database
随机推荐
CertBot 更新证书失败解决
Basic explanation of turtle module - draw curve
2/12 didn't learn anything
CADD课程学习(7)-- 模拟靶点和小分子相互作用 (柔性对接 AutoDock)
During pycharm debugging, the view is read only and pause the process to use the command line appear on the console input
P2102 floor tile laying (DFS & greed)
Explain in simple terms node template parsing error escape is not a function
How to realize automatic playback of H5 video
R note prophet
Easyrecovery靠谱不收费的数据恢复电脑软件
Crawler notes: improve data collection efficiency! Use of proxy pool and thread pool
One question per day (Mathematics)
Mlapi series - 04 - network variables and network serialization [network synchronization]
P2022 interesting numbers (binary & digit DP)
[HBZ sharing] how to locate slow queries in cloud database
软考 系统架构设计师 简明教程 | 总目录
Selection of slow motion function
Implementation of knowledge consolidation source code 2: TCP server receives and processes half packets and sticky packets
View 工作流程
Database - MySQL storage engine (deadlock)