当前位置:网站首页>也算是學習中的小總結
也算是學習中的小總結
2022-07-06 04:33: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.進行訓練
边栏推荐
- Jd.com 2: how to prevent oversold in the deduction process of commodity inventory?
- 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
- 深入浅出node模板解析错误escape is not a function
- npm命令--安装依赖包--用法/详解
- VPP性能测试
- Fedora/REHL 安装 semanage
- POI add border
- Vulnerability discovery - vulnerability probe type utilization and repair of web applications
- 10個 Istio 流量管理 最常用的例子,你知道幾個?
- [leetcode question brushing day 33] 1189 The maximum number of "balloons", 201. The number range is bitwise AND
猜你喜欢

CADD课程学习(8)-- 化合物库虚拟筛选(Virtual Screening)

Redis —— Redis In Action —— Redis 实战—— 实战篇一 —— 基于 Redis 的短信登录功能 —— Redis + Token 的共享 session 应用— 有代码

MLAPI系列 - 04 - 网络变量和网络序列化【网络同步】

Lombok原理和同时使⽤@Data和@Builder 的坑

图应用详解

Path of class file generated by idea compiling JSP page
![[face recognition series] | realize automatic makeup](/img/a5/de98d0522b9dae809cd242aac305b3.jpg)
[face recognition series] | realize automatic makeup

Etcd database source code analysis -- etcdserver bootstrap initialization storage

Overturn your cognition? The nature of get and post requests

Mysql database storage engine
随机推荐
Data processing methods - smote series and adasyn
How many of the 10 most common examples of istio traffic management do you know?
Mysql数据库慢sql抓取与分析
E. Best Pair
Lora gateway Ethernet transmission
Is the mode of education together - on campus + off campus reliable
CADD课程学习(7)-- 模拟靶点和小分子相互作用 (柔性对接 AutoDock)
MySQL learning record 13 database connection pool, pooling technology, DBCP, c3p0
How does computer nail adjust sound
深入浅出node模板解析错误escape is not a function
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
Patent | subject classification method based on graph convolution neural network fusion of multiple human brain maps
HotSpot VM
Complete list of common functions of turtle module
word封面下划线
[leetcode question brushing day 33] 1189 The maximum number of "balloons", 201. The number range is bitwise AND
Mlapi series - 04 - network variables and network serialization [network synchronization]
Recommendation | recommendation of 9 psychotherapy books
Easyrecovery靠谱不收费的数据恢复电脑软件
Dynamic programming (tree DP)