pytorch@操作符

bash 复制代码
import torch

# Define two tensors (matrices)
A = torch.tensor([[1, 2], [3, 4]])
B = torch.tensor([[5, 6], [7, 8]])

# Perform matrix multiplication using @ operator
C = A @ B

print(C)

print(torch.matmul(A,B))

print(torch.mm(A,B))

example2

bash 复制代码
import torch
import numpy as np 
m = 5
p = 3 
n = 4 

# Define two tensors (matrices)
A = torch.tensor(np.random.randn(m,p))
B = torch.tensor(np.random.randn(p,n))

# Perform matrix multiplication using @ operator
C = A @ B

print(C)

print(torch.matmul(A,B))

print(torch.mm(A,B))![在这里插入图片描述](https://i-blog.csdnimg.cn/direct/7ed9ce4cada04ce7943a7c743316f461.png)
相关推荐
派小心.11 分钟前
网站统计采样数据的误差核对
大数据·服务器·前端·数据库·人工智能·小程序·数据分析
TMT星球26 分钟前
云从科技参编两项人工智能操作系统国家标准正式发布
人工智能·科技
johnsong28 分钟前
AI 前沿日报 2026-10-14:边界渗透
人工智能
2601_9669496530 分钟前
如何判断实时行情数据是否已经更新?从时间戳、交易时段到行情有效性
开发语言·python·数据分析·pandas·量化交易·股票数据·quantdash
MoRanzhi120333 分钟前
106.正则问题(分治)
python·算法·正则表达式·蓝桥杯·递归·分治算法·字符串处理
阿里云大数据AI技术38 分钟前
在 EMR Serverless Spark 中访问 Fluss
人工智能·spark
Dawson Zhu40 分钟前
《Agentic Design Patterns》第 21 章导读:探索与发现
人工智能·语言模型·架构·aigc·agi
龙腾AI白云40 分钟前
数字孪生、具身智能、世界模型三者交叉
数据库·人工智能·机器学习·flask·pygame
JAVA_AI人工智能项目实战43 分钟前
大模型结构演进.学习笔记
大数据·人工智能·语言模型·架构
商业数据派1 小时前
京东11.11:首日下单用户数同比双位数增长、超百项服务首次全景亮相
人工智能