当前位置:网站首页>也算是學習中的小總結
也算是學習中的小總結
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.進行訓練
边栏推荐
- Canal synchronizes MySQL data changes to Kafka (CentOS deployment)
- Lombok原理和同时使⽤@Data和@Builder 的坑
- Solution of storage bar code management system in food industry
- During pycharm debugging, the view is read only and pause the process to use the command line appear on the console input
- R note prophet
- Slow SQL fetching and analysis of MySQL database
- 满足多元需求:捷码打造3大一站式开发套餐,助力高效开发
- Cross domain and jsonp details
- How to realize automatic playback of H5 video
- NPM command -- install dependent packages -- Usage / explanation
猜你喜欢

The most detailed and comprehensive update content and all functions of guitar pro 8.0

题解:《单词覆盖还原》、《最长连号》、《小玉买文具》、《小玉家的电费》

Visio draw fan

电脑钉钉怎么调整声音

1291_Xshell日志中增加时间戳的功能

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

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 many of the 10 most common examples of istio traffic management do you know?

How to realize automatic playback of H5 video

coreldraw2022新版本新功能介绍cdr2022
随机推荐
Is the mode of education together - on campus + off campus reliable
Mlapi series - 04 - network variables and network serialization [network synchronization]
Mysql database storage engine
729. 我的日程安排表 I(set or 动态开点线段树)
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
ETCD数据库源码分析——etcdserver bootstrap初始化存储
VPP性能测试
电脑钉钉怎么调整声音
Can Flink SQL read multiple topics at the same time. How to write in with
【Try to Hack】john哈希破解工具
Execution order of scripts bound to game objects
Practical development of member management applet 06 introduction to life cycle function and user-defined method
Redis - redis in action - redis actual combat - actual combat Chapter 1 - SMS login function based on redis - redis + token shared session application - with code
English Vocabulary - life scene memory method
Data processing methods - smote series and adasyn
[tomato assistant installation]
[Chongqing Guangdong education] Suzhou University English film and Television Appreciation reference materials
Meet diverse needs: jetmade creates three one-stop development packages to help efficient development
Recommendation system (IX) PNN model (product based neural networks)
How does computer nail adjust sound