pytorch:torch.mm()和torch.matmul()的使用
作者:大雄没有叮当猫 时间:2022-05-25 21:32:40
如下所示:
torch.mm(mat1, mat2, out=None) → Tensor
torch.matmul(mat1, mat2, out=None) → Tensor
对矩阵mat1和mat2进行相乘。 如果mat1 是一个n×m张量,mat2 是一个 m×p 张量,将会输出一个 n×p 张量out。
参数 :
mat1 (Tensor) – 第一个相乘矩阵
mat2 (Tensor) – 第二个相乘矩阵
out (Tensor, optional) – 输出张量
代码示例:
import torch
a=torch.randn(2,3)
b=torch.randn(3,2)
print(torch.mm(a,b))
print(torch.matmul(a,b))
来源:https://blog.csdn.net/u013230189/article/details/82627077
标签:pytorch,torch.mm,torch.matmul
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
解决django的template中如果无法引用MEDIA_URL问题
2023-06-12 15:09:07
Python的gevent框架的入门教程
2023-06-26 16:58:34
python将视频转换为全字符视频
2023-08-08 21:01:02
![](https://img.aspxhome.com/file/2023/8/61748_0s.gif)
Python 取numpy数组的某几行某几列方法
2023-11-24 05:46:47
![](https://img.aspxhome.com/file/2023/5/64655_0s.png)
Python实现强制复制粘贴的示例详解
2021-03-30 23:58:43
![](https://img.aspxhome.com/file/2023/6/69036_0s.png)
Python中使用异常处理来判断运行的操作系统平台方法
2021-03-28 07:37:23
PHP实现的简单排列组合算法应用示例
2023-11-18 16:28:40
python2.7读取文件夹下所有文件名称及内容的方法
2023-12-16 03:27:07
html风格tooltip效果的实现
2010-04-08 13:00:00
PHP源码之 ext/mysql扩展部分
2023-07-21 18:24:20
Python对字符串实现去重操作的方法示例
2021-12-12 11:46:37
![](https://img.aspxhome.com/file/2023/5/87885_0s.jpg)
Mongodb基本操作与Python连接mongodb并进行基础操作的方法
2023-10-14 23:55:51
css样式表滤镜全接触
2007-10-26 12:48:00
教你在MySQL 5.0以上版本中配置主从库
2009-01-04 13:17:00
Python魔法方法 容器部方法详解
2021-02-05 19:25:43
oracle初始化参数设置
2010-07-31 12:47:00
python3实现zabbix告警推送钉钉的示例
2023-01-16 06:59:04
![](https://img.aspxhome.com/file/2023/3/80613_0s.jpg)
Python函数实现学员管理系统
2023-06-22 03:32:30
![](https://img.aspxhome.com/file/2023/0/97380_0s.jpg)
《色彩解答》系列之一 色彩层次
2008-02-17 14:26:00
![](https://img.aspxhome.com/file/UploadPic/20082/17/2008217143752778s.gif)
详解python的字典及相关操作
2023-03-28 08:52:42
![](https://img.aspxhome.com/file/2023/3/71543_0s.png)