当前位置:网站首页>Multiplication in pytorch: mul (), multiply (), matmul (), mm (), MV (), dot ()
Multiplication in pytorch: mul (), multiply (), matmul (), mm (), MV (), dot ()
2022-07-07 16:03:00 【Pig man with small bottle cap】
torch.mul()
The functionality : Pair by pair input and other Multiply the corresponding elements in .
This operation supports broadcasting , therefore input and other Both can be tensors or numbers
import torch
a = torch.randn((1,2))
b = torch.randn((2,1))
print(a,b)
torch.mul(a,b)
torch.multiply()
torch.mul() The nickname
torch.matmul()
matmul You can do tensor multiplication , The input can be high-dimensional .
torch.dot()
The functionality : Calculation input and output Dot product of , This function requires input and output Must be a one-dimensional tensor ( Its shape There is only one value in the property )! And the number of elements of both is required to be the same !
import torch
x = torch.Tensor([1,2])
y = torch.Tensor([3,4])
z = torch.dot(x,y)
z
torch.mm()
The functionality : Realize matrix multiplication in Linear Algebra (matrix multiplication):(n×m) × (m×p) = (n×p) .
This function does not allow broadcasting !
import torch
x = torch.randn((3,4))
y = torch.randn((4,5))
z = torch.mm(x,y)
z
torch.mv()
The functionality : Realize matrix and vector (matrix × vector) Multiplication of , requirement input The shape of is n×m,output by torch.Size([m]) One dimension of tensor.
import torch
x = torch.randn((3,4))
y = torch.randn(4)
z = torch.mv(x,y)
z
边栏推荐
- markdown公式编辑教程
- Three. JS introductory learning notes 15: threejs frame animation module
- Webcodecs parameter settings -avc1.42e01e meaning
- UE4 exports the picture + text combination diagram through ucanvasrendertarget2d
- Apache Doris just "graduated": why should we pay attention to this kind of SQL data warehouse?
- 招标公告:2022年云南联通gbase数据库维保公开比选项目(第二次)比选公告
- JS array foreach source code parsing
- C4D learning notes 2- animation - timeline and time function
- Bidding announcement: 2022 Yunnan Unicom gbase database maintenance public comparison and selection project (second) comparison and selection announcement
- 一大波开源小抄来袭
猜你喜欢
分步式監控平臺zabbix
Async and await
C4D learning notes 2- animation - timeline and time function
A wave of open source notebooks is coming
Unity3D_ Class fishing project, bullet rebound effect is achieved
Mesh merging under ue4/ue5 runtime
Wireless sensor networks -- ZigBee and 6LoWPAN
【花雕体验】15 尝试搭建Beetle ESP32 C3之Arduino开发环境
Annexb and avcc are two methods of data segmentation in decoding
postman生成时间戳,未来时间戳
随机推荐
The "go to definition" in VS2010 does not respond or prompts the solution of "symbol not found"
postman生成时间戳,未来时间戳
Three. JS introductory learning notes 08:orbitcontrols JS plug-in - mouse control model rotation, zoom in, zoom out, translation, etc
Numpy -- data cleaning
喜讯!科蓝SUNDB数据库与鸿数科技隐私数据保护管理软件完成兼容性适配
星瑞格数据库入围“2021年度福建省信息技术应用创新典型解决方案”
一个普通人除了去工厂上班赚钱,还能干什么工作?
航運船公司人工智能AI產品成熟化標准化規模應用,全球港航人工智能/集裝箱人工智能領軍者CIMC中集飛瞳,打造國際航運智能化標杆
Step by step monitoring platform ZABBIX
Use of SVN
numpy--数据清洗
Please supervise the 2022 plan
Eye of depth (VI) -- inverse of matrix (attachment: some ideas of logistic model)
[flower carving experience] 15 try to build the Arduino development environment of beetle esp32 C3
Is it reliable to open an account on Tongda letter with your mobile phone? Is there any potential safety hazard in such stock speculation
Three singleton modes of unity (hungry man, lazy man, monobehavior)
融云斩获 2022 中国信创数字化办公门户卓越产品奖!
Postman generate timestamp, future timestamp
Unity3D_ Class fishing project, control the distance between collision walls to adapt to different models
Shader Language