当前位置:网站首页>也算是學習中的小總結
也算是學習中的小總結
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.進行訓練
边栏推荐
- 深入浅出node模板解析错误escape is not a function
- Ue5 small knowledge points to enable the setting of lumen
- Database - MySQL storage engine (deadlock)
- Lombok principle and the pit of ⽤ @data and @builder at the same time
- POI add border
- Mysql database storage engine
- C. The Third Problem(找规律)
- Use sentinel to interface locally
- Basic use of MySQL (it is recommended to read and recite the content)
- English Vocabulary - life scene memory method
猜你喜欢
关于进程、线程、协程、同步、异步、阻塞、非阻塞、并发、并行、串行的理解
R note prophet
Redis —— Redis In Action —— Redis 实战—— 实战篇一 —— 基于 Redis 的短信登录功能 —— Redis + Token 的共享 session 应用— 有代码
Figure application details
CADD课程学习(8)-- 化合物库虚拟筛选(Virtual Screening)
Recommendation system (IX) PNN model (product based neural networks)
Mysql数据库慢sql抓取与分析
Path of class file generated by idea compiling JSP page
Introduction to hashtable
English Vocabulary - life scene memory method
随机推荐
Selection of slow motion function
Can CDC pull the Oracle table in full
2/11 matrix fast power +dp+ bisection
Mysql数据库慢sql抓取与分析
P2022 interesting numbers (binary & digit DP)
QML和QWidget混合开发(初探)
Yyds dry goods inventory OSI & tcp/ip
VPP性能测试
One question per day (Mathematics)
The most detailed and comprehensive update content and all functions of guitar pro 8.0
[Zhao Yuqiang] deploy kubernetes cluster with binary package
Meet diverse needs: jetmade creates three one-stop development packages to help efficient development
Figure application details
Data processing methods - smote series and adasyn
Hashlimit rate control
Knowledge consolidation source code implementation 3: buffer ringbuffer
Practical development of member management applet 06 introduction to life cycle function and user-defined method
MIT CMS. 300 session 8 – immersion / immersion
Etcd database source code analysis -- etcdserver bootstrap initialization storage
Brief tutorial for soft exam system architecture designer | general catalog